You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Umashanker, Srividhya" <sr...@hp.com> on 2013/10/29 08:57:26 UTC

DateQuery with comparison operators

HI -

I are using Lucene 4.5  and want to support date comparisons  with < > <= >= !=.
Right now, we parse the string and create RangeQuery. Is there an inbuilt way to do date based comparisons ie., "dob <= 2013-10-23T14:47:54.776Z"

-Vidhya

Re: DateQuery with comparison operators

Posted by Jack Krupansky <ja...@basetechnology.com>.
Sorry, but the Lucene and Solr query parsers do not have support for the 
relational operators (although the LucidWorks Search query parser does, but 
that's for Solr). You simply need to use range queries:

x < v   -> x:[* TO v}
x <= v   -> x:[* TO v]
x > v -> x:{v TO *]
x >= v -> x:[v TO *]

Note the use of curly braces for exclusive end points.

-- Jack Krupansky

-----Original Message----- 
From: Umashanker, Srividhya
Sent: Tuesday, October 29, 2013 3:57 AM
To: java-user@lucene.apache.org
Subject: DateQuery with comparison operators

HI -

I are using Lucene 4.5  and want to support date comparisons  with < > <= >= 
!=.
Right now, we parse the string and create RangeQuery. Is there an inbuilt 
way to do date based comparisons ie., "dob <= 2013-10-23T14:47:54.776Z"

-Vidhya 


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