thanks Adrien for the explanation, it's really much appreciated.

I have written a quick test to reproduce the slower sorting with numeric DV. In this test case, it happens only when reverse sorting.

About the sorting by page i mentioned, it was due to a mistake in our testcase, sorry about that. I will make sure to test in a simpler environment next time ;)




On Tue, Jul 30, 2013 at 3:13 PM, Adrien Grand <jpountz@gmail.com> wrote:
Hi,

On Tue, Jul 30, 2013 at 8:19 PM, Nicolas Guyot <sfnicow@gmail.com> 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
(slower).

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?

--
Adrien

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org