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 Björn Ekengren <bj...@avanza.se> on 2006/10/05 15:32:09 UTC
Sorting on dates using long
Hello,
I am trying to get sort by date to work. The dates are of form yyyyMMddhhmm and it seems that sort sees them as Integers and discards the last four numbers since an integer isn't large enough. I tried using SortField.STRING instead but then constantrangequery breaks (date:[200501010101 TO 200601010101] returns 0 hits). Is it possible to sort using a long or are there any other solutions ? I would like to avoid splitting the date into several fields by other reasons.
--regards
Re: Sorting on dates using long
Posted by Yonik Seeley <yo...@apache.org>.
On 10/5/06, Björn Ekengren <bj...@avanza.se> wrote:
> I am trying to get sort by date to work. The dates are of form yyyyMMddhhmm and it seems that sort sees them as Integers and discards the last four numbers since an integer isn't large enough. I tried using SortField.STRING instead but then constantrangequery breaks (date:[200501010101 TO 200601010101] returns 0 hits).
Using SortField.STRING should work, both with sorting and range
queries via RangeFilter or ConstantScoreRangeQuery.
-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org