lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lance bowler <lanceb...@gmail.com>
Subject [lucy-user] Filter + ClusterSearcher/QueryParser/make_compiler
Date Mon, 19 Dec 2011 13:42:02 GMT
Hi,

I'm trying to wrap my head around how to perform a normal query, plus
filter out/in results based on a field which has 0|1 (non-indexed,
stored), something like Google's safesearch, using
ClusterSearcher/QueryParser/make_compiler.  Now, if I was using
straight Lucy::Search::QueryParser, then life is sweet

my $filter = LucyX::Search::Filter->new(query => "field:0");  # or 1
my $and_query  = Lucy::Search::ANDQuery->new;
$and_query->add_child($user_query_str);
$and_query->add_child($filter);
my $hits = $searcher->hits( query => $and_query );

will do the trick, presumably.

But I'm trying to figure out how to do that when using the following sequence:

Lucy::Search::ANDQuery ('field:0|1' presumably) or LucyX::Search::Filter,
my $searcher = LucyX::Remote::ClusterSearcher->new...
my $query_parser = Lucy::Search::QueryParser->new...
my $query_obj = $query_parser->parse($user_query_str);
my $query_compiler = $query_obj->make_compiler( searcher => $searcher );
$hits = $searcher->hits( query => $query_compiler,...);


My stupid button is engaged, and even after reading the docs, I can't
see how to re-code my sequence above.

Finally:  *can* I filter on a field which is not indexed (contains a
simple 0 or 1)?

Thanks for any pointers.

Mime
View raw message