[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kinosearch
Subject:    [KinoSearch] Synonym Queries
From:       marvin () rectangular ! com (Marvin Humphrey)
Date:       2006-03-10 10:34:33
Message-ID: 394188F8-3121-4B00-855E-09D04E9AFF85 () rectangular ! com
[Download RAW message or body]

I botched this recipe:

>     my $query_parser  = KinoSearch::QueryParser::QueryParser->new(
>         default_field => 'bodytext',
>     );
>     my $general_query = $query_parser->parse( $q );
>
>     my $news_only     = KinoSearch::Search::TermQuery->new(
>         term => KinoSearch::Index::Term->new( 'category', 'news' );
>     );
>
>     my $bool_query    = KinoSearch::Search::BooleanQuery->new;
>     $bool_query->add_clause( query => $general_query, occur =>  
> 'SHOULD' );
>     $bool_query->add_clause( query => $news_only,     occur =>  
> 'MUST' );

As written, every search would match all the items that have a  
category of "news".  If $general_query was successful, its matches  
would rank at the top, but you'd still have too many matches.

The correct value for the $general_query's occur is 'MUST':

     $bool_query->add_clause( query => $general_query, occur =>  
'MUST' );

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic