lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Stewart <...@lightboxtechnologies.com>
Subject StandardQueryParser with date/time fields stored as longs
Date Wed, 11 Feb 2015 04:21:45 GMT
Hello,

I've done a lot of googling, but haven't stumbled upon the magic
answer: how does one use StandardQueryParser with numeric fields
representing timestamps, to allow for range queries?

When indexing, my timestamp fields are ISO 8601 strings. I'm parsing
them and then storing the milliseconds epoch time as a long, i.e.:

  doc.add(new LongField("created", ts.getMillis(), Field.Store.NO));

>From reading around, this seems to be the preferred method to index a
timestamp (makes sense). However, how can you get StandardQueryParser
to handle a query like "created:[2010-01-01 TO 2014-12-31]"?

For other numeric fields, StandardQueryParser.setNumericConfigMap() is
working just fine for me. It would seem that the "created" field would
have to be part of this map in order to execute the range query
properly, but that there must also be a component to parse the
date/time strings in the query and convert them to long values, right?

Thanks in advance,

Jon

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