lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sheetal Deshpande <tosheet...@gmail.com>
Subject Unable to sort using datetime field in Lucene
Date Tue, 12 Jul 2016 14:38:26 GMT
Hello Java Lucene dev's,

I'm pretty much a newbie when it comes to Lucene. Actually I have a query.
I am using Lucene for indexing logs, so as to make the searching of logs
effective. No doubt, it is working hassle free, but here is something where
I am stuck since days. I want to sort these logs date wise, the latest
being the first in the result(descending order). For this, I have added a
datetime field during indexing in the document.
Something like this:
long dateTime =
DateUtil.getTime(logObject.getDate(),logObject.getTime(),"dd.MM.yyyy
HH:mm:ss:S");
document.add(new LongField("datetime",dateTime,Field.Store.YES));
---
Now while searching, I am adding these lines:
TopDocs result = null;
----code here----
Sort sort = new Sort(new SortField("datetime", SortField.Type.LONG));
result = searcher.search(query,recCountToFetch,sort);
I wished it would work fine, but then I a came across this error:
javax.xml.ws.soap.SOAPFaultException: java.lang.Exception:
java.lang.IllegalStateException: unexpected docvalues type NONE for field
'datetime' (expected=NUMERIC). Use UninvertingReader or index with
docvalues.

Any hint/ suggestions/ guidance on how to tackle this error? Also please
correct me if I am going the wrong way.
Thanks in advance! Anticipating your reply.

-- 
Regards,
Sheetal Deshpande.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message