[KinoSearch] Stemming and Term/TermQuery

Evaldas Imbrasas evaldas at imbrasas.com
Fri Aug 17 15:53:52 PDT 2007



On 8/14/07, Evaldas Imbrasas <evaldas at imbrasas.com> wrote:
> > >  The first series is done using a simple query call:
> > >     my $hits = $searcher->search(query => 'organic');
> > >
> > > The second series is done using TermQuery:
> > >     my $term = KinoSearch::Index::Term->new(title => 'organic');
> > >     my $by_title = KinoSearch::Search::TermQuery->new(term => $term);
> > >     my $hits = $searcher->search(query => $by_title);
> > >
> > > I expect both series to produce the same results, since there's only
> > > one field indexed per document.
> >
> > They will not.  The one passing through the Searcher is receiving
> > additional processing -- crucially, it is being passed through an
> > Analyzer.  In the first you are searching for 'organ', which is in
> > the index.  In the second, you are searching for 'organic', which is
> > not.
>
> I see. Is there a way to make the search term in example #2 receive
> the same additional processing as in #1?

Replying to myself so that the solution is saved in the archives. In
0.15, this issue can be solved using QueryParser:

my $title_parser = KinoSearch::QueryParser::QueryParser->new(
    analyzer       => $analyzer,
    fields         => ['title'],
    default_boolop => 'AND',
);
my $by_title = $tag_parser->parse('organic');
$bool_query->add_clause(query => $by_title, occur => 'MUST');

-- 
-----------------------------------------------------
Evaldas Imbrasas
http://www.imbrasas.com

_______________________________________________
KinoSearch mailing list
KinoSearch at rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch




More information about the kinosearch mailing list