> So, can doc values be persisted with order of values, not document id? This 
> should be fast in sort scenario that the values are pre-ordered instead of 
> scan/sort at runtime.


No, unfortunately doc values cannot be persisted in order. Lucene stores this 
values internally as a DocValuesType.SORTED_SET, where the values are being 
stored using for example Long.compareTo(). 

If you'd like to retrieve the values in insertion order, use stored instead of 
doc values instead of. Then you might access the values in order using the 
LeafReader's document function. However, beware that may induce performance 
issues because it requires loading the document from disk. 

If you require to store and retrieve multiple numeric values per document in 
order, you might consider using PointValues. PointValues are internally indexed 
with KD-trees. But, beware that PointValues have a limited dimensionality, in 
terms that you can for example store values in 8 dimensions, each of max 16 
bytes.    

> On 5 Mar 2018, at 15:33, Tony Ma <t...@opentext.com> wrote:
> 
> Per my understanding, doc values (binary doc values / numeric doc values) are 
> stored with sequence of document id. Sorted numeric doc values just means if 
> a document has multiple values, the values will be sorted for same document, 
> but for different documents, the value is still ordered by document id. Is 
> that true?
> So, can doc values be persisted with order of values, not document id? This 
> should be fast in sort scenario that the values are pre-ordered instead of 
> scan/sort at runtime.


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

Reply via email to