lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrien Grand <jpou...@gmail.com>
Subject Re: NumericDocValues vs SortedNumericDocValues
Date Tue, 06 Feb 2018 09:00:55 GMT
For a single-valued double, you should create a field at index time by
calling `new NumericDocValuesField(myDoubleFieldName,
Double.doubleToLongBits(myDoubleValue))` at index time and then sort using
`new SortField(myDoubleFieldName, SortField.Type.DOUBLE)`.

SortedNumericDocValues is about storing multiple values per document. The
reason it has "Sorted" in the name is because it doesn't try to remember
the insertion order and always returns values in ascending order for a
given document at search time. But for a single-valued field it would be
less efficient and harder to use than NumericDocValues.

Le lun. 5 févr. 2018 à 21:34, Tom Hirschfeld <tomhirschfeld@gmail.com> a
écrit :

> Hello,
>
> I need to sort the results of a query based on a single double value for
> each document. I am not sure which of the NumericDocValues or the
> SortedNumericDocValues would be best to use. Each document will have a
> single value indexed. We are indexing ~100m - 1B documents and each query
> will sort about 200 results. My specific questions are, for our use case,
> how do these two fields differ in:
>
> 1) total index size
> 2) query time performance/impact on sorting
> 3) any other "gotchas" I may not have thought of yet
>
> Thanks for your time & assistance!
> Best,
> Tom Hirschfeld
>

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