lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrien Grand <>
Subject Re: sorting with lucene 4.3
Date Tue, 30 Jul 2013 22:13:49 GMT

On Tue, Jul 30, 2013 at 8:19 PM, Nicolas Guyot <> wrote:
> When sorting numerically, the search seems to take a bit of a while
> compared to the lexically sorted search.
> Also when sorting numerically the result is sorted within each page but no
> globally as opposed to the lexical sorted search.
> From my understanding, a SortedDocValuesField is sorted while indexing but
> not the NumericDocValuesField which is why we are facing those issues in
> our implementation. Is that correct ?

Sorted doc values are not exactly sorted, but Lucene computes all
unique values, sorts them and assigns an ordinal to every unique
value. These ordinals are then used at searching time to sort
documents. When comparing documents on the same segment, Lucene
directly uses the ordinals while when there are documents from
different documents to compare, Lucene uses the values themselves

I would expect sorting on a NumericDocValuesField to be faster since
longs can be used to directly compare documents across all segments.
Moreover, it is not normal that data is only sorted per page. Can you
write a small piece of code that reproduces the problem?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message