On 1/17/2014 12:59 PM, solr2020 wrote:
We are writing our own search handler. We are facing this below issue.
We are passing a
date(Date:(["2012-10-01T00:00:00.000Z"+TO+"2012-10-01T23:59:59.999Z"])) for
date range search to QParser.getParser method but it is converting the date
to unix timestamp format.(Date:([1322179200000 TO 1322265599999])). is there
anyway to get the same date as we passed.
QParser queryParser = QParser.getParser(q, defType, req);
Query query = queryParser.getQuery();
DocList matchDocs2 = indexSearcher.getDocList(query1, null, null, 1,
10,10000);
|That's not exactly a UNIX timestamp. It's similar, but in milliseconds
rather than seconds. This is how Java deals with time internally. I'm
fairly sure that this is also how Solr's date types work internally.
http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#currentTimeMillis%28%29
Java's millisecond tracking uses a long rather than an int, so it's not
going to run out of numbers when 2038 rolls around like a standard UNIX
timestamp will..
I think what you're seeing is normal. The same thing happens when you
include debugQuery=true with the standard query parser. Here's the
first part of a debugQuery output from a test query:
"debug": {
"rawquerystring": "pd:[2013-01-01T00:00:00Z TO *]",
"querystring": "pd:[2013-01-01T00:00:00Z TO *]",
"parsedquery": "pd:[1356998400000 TO *]",
"parsedquery_toString": "pd:[1356998400000 TO *]",
||Thanks,
Shawn
|