lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vjeran Marcinko <vjeran.marci...@email.t-com.hr>
Subject Customizing/overriding date format in StandardQueryParser
Date Fri, 14 Jul 2017 07:04:37 GMT
Hi all,

If I store my time fields via DateTools, then I can use 
StandardQueryParser's range syntax for specifing date range:

someField:[20170314 TO 20170922]

, but unfortunately this is not date format that I want to present to my 
users. I examined parser API a bit, and the only thing I can find is 
setting Locale which will affect this date format, but unfortunately 
this is still not what satisfies me. The thing I need is somewhere to 
set say some SimpleDateFormat pattern I want, say:
yyyy-MM-HH mm:ss

Now, by guick glance, I can see that QueryParser package and its 
packages is a huge API, and overwhelming for Lucene newbie like me, so 
can someone suggest some way of customizing this format, or even some 
short guidelines how to add to StandardQueryParser some new "function" 
with special syntax which I can ultimately convert underneath to date 
range query which I know how to do programmatically. Say something like 
having beside standard syntax the ability to write for some field:

someField:dateRange(2017-02-03 22:00, 2017-05-00 22:00)

And underneath to construct a Query by using for example 
LongPoint.newRangeQuery("someField", lowerValueMillis, 
upperValueMillis). Of course, this query requires that time fields be 
indexed as LongPoint, but I can do it also, so no problem with that. The 
only thing I need is how to plug in to StandardQueryParser this 
"function specific parser".


Thanx,

Vjeran


---------------------------------------------------------------------
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