Show
Ignore:
Timestamp:
01/20/08 18:46:51 (12 months ago)
Author:
earle
Message:

Don't include redirect pages in search results. Closes #24.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides/Search.pm

    r1034 r1140  
    504504    } 
    505505 
    506     # It'll be a real phrase (as opposed to a word) if it has a space in it. 
    507     # In this case, dump out the nodes that don't match the search exactly. 
    508     # I don't know why the phrase searching isn't working properly.  Fix later. 
    509     if ( $phrase =~ /\s/ ) { 
    510         my @tmp = keys %contents_res; 
    511         foreach my $node ( @tmp ) { 
    512             my $content = $wiki->retrieve_node( $node ); 
     506    my @tmp = keys %contents_res; 
     507    foreach my $node ( @tmp ) { 
     508        my $content = $wiki->retrieve_node( $node ); 
     509 
     510        # Don't include redirects in search results. 
     511        if ($content =~ /^#REDIRECT/) { 
     512            delete $contents_res{$node}; 
     513            next; 
     514        } 
     515         
     516        # It'll be a real phrase (as opposed to a word) if it has a space in it. 
     517        # In this case, dump out the nodes that don't match the search exactly. 
     518        # I don't know why the phrase searching isn't working properly.  Fix later. 
     519        if ( $phrase =~ /\s/ ) { 
    513520            unless ( $content =~ /$phrase/i || $node =~ /$phrase/i ) { 
    514521                delete $contents_res{$node}; 
    515             } 
    516         } 
     522            } 
     523        } 
     524 
    517525    } 
    518526