Changeset 240


Ignore:
Timestamp:
Sep 23, 2003, 3:34:48 PM (18 years ago)
Author:
kake
Message:

Search box now searches categories and locales as well as title and body.

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r239 r240  
    1 0.25   
     10.25    23 September 2003
    22        Applied recent changes fix to front page feed as well.
     3        Search box now searches categories and locales as well as title and
     4          body - so for example a search on "holborn & pubs" will DTRT.
    35
    460.24    8 September 2003
  • trunk/MANIFEST

    r239 r240  
    5757t/22_rss_modwiki.t
    5858t/31_supersearch.t
     59t/32_supersearch_simple_metadata.t
    5960t/41_pubcrawl.t
    6061t/51_diff.t
  • trunk/PREREQUISITES

    r239 r240  
    1 Modules required by OpenGuides 0.24
     1Modules required by OpenGuides 0.25
    22===================================
    33
  • trunk/lib/OpenGuides/SuperSearch.pm

    r239 r240  
    175175    my ($self, $search) = @_;
    176176    my $wiki = $self->{wiki};
     177
     178    # Search title and body.
    177179    my %results = $wiki->search_nodes( $search );
    178 
    179180    foreach my $node ( keys %results ) {
    180181        my $key = $wiki->formatter->node_name_to_node_param( $node );
    181182        my $text = $node . " " . $wiki->retrieve_node( $node );
    182183        $self->{wikitext}{$key} ||= $self->_mungepage( $text );
     184    }
     185
     186    # Search categories.
     187    my @catmatches = $wiki->list_nodes_by_metadata(
     188                         metadata_type => "category",
     189                         metadata_value => $search,
     190    );
     191    foreach my $node ( @catmatches ) {
     192        my $key = $wiki->formatter->node_name_to_node_param( $node );
     193        my $text = $node. " " . $wiki->retrieve_node( $node );
     194        $self->{wikitext}{$key} ||= $self->_mungepage( $text );
     195        # Append this category so the regex finds it later.
     196        $self->{wikitext}{$key} .= " [$search]";
     197    }
     198
     199    # Search locales.
     200    my @locmatches = $wiki->list_nodes_by_metadata(
     201                         metadata_type => "locale",
     202                         metadata_value => $search,
     203    );
     204    foreach my $node ( @locmatches ) {
     205        my $key = $wiki->formatter->node_name_to_node_param( $node );
     206        my $text = $node. " " . $wiki->retrieve_node( $node );
     207        $self->{wikitext}{$key} ||= $self->_mungepage( $text );
     208        # Append this locale so the regex finds it later.
     209        $self->{wikitext}{$key} .= " [$search]";
    183210    }
    184211}
Note: See TracChangeset for help on using the changeset viewer.