lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Associating a FieldValueFilter with a search query
Date Tue, 12 Nov 2013 08:20:11 GMT
Hi Ramprakash,

the query parser cannot handle that out of the box. Applying such filters or special Queries
like SpanQueries can only be applied in Java code. In general you should always create-machine
generated queries not by doing string concats and then calling the queryparser, instead build
the query tree using the constructors of various queries and filter classes.

If you really need support inside a queryparser that parses strings, you have to write your
own one or modify the existing queryparser to detect the syntax and apply the filters.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Ramprakash Ramamoorthy [mailto:youngestachiever@gmail.com]
> Sent: Tuesday, November 12, 2013 7:46 AM
> To: java-user@lucene.apache.org
> Subject: Associating a FieldValueFilter with a search query
> 
> Hello,
> 
> I would like to search for documents that do not have a value for a particular
> field. I understand org.apache.lucene.search.FieldValueFilter
> serves the purpose to filter out documents that have/do-not-have a value.
> 
> I am just wondering the way to associate this filter with a Query object. I use
> QueryParser to construct the Query object. Let me illustrate with a sample
> query.
> 
> Sample Query : (Author:John OR Author:Harry) AND (-Published_Year:NULL
> OR
> Title:Delhi*)
> 
> In the above query, I just want to use the FieldValueFilter for the criteria *-
> Published_Year:NULL*
> 
> Am I missing something basic here? Glad if you can help. Thanks in advance.
> 
> --
> With Thanks and Regards,
> Ramprakash Ramamoorthy,
> Chennai, India


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message