Mailing List Archive

Using QueryFilter and TermQuery
Hi All

I'm using KinoSearch-0.162. When doing a search for a single word
($Source), KS returns the correct results.
However when doing so for a string of words (eg. $Source = "foo foo foo
blah blah") it returns no results at all.
NB. 'site' has been indexed correctly. Could any please assist regarding
this?

my $SiteOnly = KinoSearch::Search::TermQuery->new( term =>
KinoSearch::Index::Term->new( 'site', $Source ) );
my $filter = KinoSearch::Search::QueryFilter->new( query => $SiteOnly );

$hits = $searcher->search(
query => $query,
filter => $filter
);

...


Appreciated
Riyaad

_______________________________________________
KinoSearch mailing list
KinoSearch@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
Re: Using QueryFilter and TermQuery [ In reply to ]
On Jul 21, 2008, at 8:03 AM, Riyaad Miller wrote:

> However when doing so for a string of words (eg. $Source = "foo foo
> foo blah blah") it returns no results at all.
> NB. 'site' has been indexed correctly. Could any please assist
> regarding this?

The problem is that TermQuery's constructor applies raw text. It
doesn't parse.

> my $SiteOnly = KinoSearch::Search::TermQuery->new( term =>
> KinoSearch::Index::Term->new( 'site', $Source ) );

Try using field-specific QueryParsers. In 0.162...

my $site_only_parser = KinoSearch::QueryParser::QueryParser->new(
analyzer => $analyzer,
fields => ['site'],
);
my $site_only = $site_only_parser->parse($site_qstring);
...

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


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