You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucy.apache.org by Peter Karman <pe...@peknet.com> on 2013/06/26 04:40:24 UTC

[lucy-user] [ANNOUNCE] LucyX::Search::NullTermQuery 0.003

LucyX::Search::NullTermQuery 0.003 is now on CPAN.

This Lucy query extension supports looking for empty and not empty fields,
similar to a NULL SQL query.

Example:

 foo:NULL
 foo!:NULL   # or NOT foo:NULL

syntax above supported by Search::Query::Dialect::Lucy 0.10, also now on CPAN.

my $parser = Search::Query->parser(
    dialect   => 'Lucy',
    null_term => 'NULL',
);
my $query = $parser->parse('foo:NULL');
my $hits = $lucy_searcher->hits( query => $query->as_lucy_query() );



-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com

Re: [lucy-user] Re: LucyX::Search::NullTermQuery 0.003

Posted by Peter Karman <pe...@peknet.com>.
Aleksandar Radovanovic wrote on 7/1/13 6:38 AM:
> Great work Peter! Thank you!
> 
> And, ... :-) just wondering, is there a way one ca use NullTermQuery /
> AnyTermQuery to return all records for an empty query string? 


The classes themselves do not require a query term. They just require a field name.

 my $null_query = LucyX::Search::NullTermQuery->new( field => 'foo' );

Or are you asking if the query parser supports this syntax:

 foo:

instead of:

 foo:NULL

I.e., the empty string and the undef value are considered equivalent to NULL.


> Also, is there a
> way to query multiple fields?
> 

sure. join them with OR or AND.

 foo:NULL or bar:NULL


-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com

[lucy-user] Re: LucyX::Search::NullTermQuery 0.003

Posted by Aleksandar Radovanovic <Al...@Radovanovic.com>.
Great work Peter! Thank you!

And, ... :-) just wondering, is there a way one ca use NullTermQuery / 
AnyTermQuery to return all records for an empty query string? Also, is 
there a way to query multiple fields?

Alex

On 6/26/13 5:40 AM, Peter Karman wrote:
> LucyX::Search::NullTermQuery 0.003 is now on CPAN.
>
> This Lucy query extension supports looking for empty and not empty fields,
> similar to a NULL SQL query.
>
> Example:
>
>   foo:NULL
>   foo!:NULL   # or NOT foo:NULL
>
> syntax above supported by Search::Query::Dialect::Lucy 0.10, also now on CPAN.
>
> my $parser = Search::Query->parser(
>      dialect   => 'Lucy',
>      null_term => 'NULL',
> );
> my $query = $parser->parse('foo:NULL');
> my $hits = $lucy_searcher->hits( query => $query->as_lucy_query() );
>
>
>