lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <>
Subject Re: Sorting, Range Query, faceting - NumericDocValuesField Vs LongField
Date Fri, 23 Dec 2016 03:37:46 GMT
bq: Does this mean LongField/IntField just supports lexicographic
order in sorting?

no on several counts.

No numeric type (long, int, float, double or trie values) support
lexicographic sorting. That's the whole _point_ of having numeric
types in the first place. Well, and efficient range queries in the
Trie variants.

docValues are an additional _attribute_ on the field so it's perfectly
reasonable to have a long field that's both
indexed="true"  and docValues="true". Or
indexed="true"  and docValues="false". Or
indexed="false" and docValues="true". Or
indexed="false" and docValues="false"

Do not think of them as separate field types.

indexed="true" is _required_ for searching. A field with
indexed="true" and docValues="false" also supports faceting, grouping
and sorting (numeric).

A field with docValues="true" just supports faceting, grouping and
sorting without having to "uninvert" the field in the Java heap, the
data is out in OS cache. See Uwe's excellent blog here:


On Thu, Dec 22, 2016 at 6:57 PM, Kumaran Ramasubramanian
<> wrote:
> Thank you Adrien.
> "NumericDocValuesField is the one that supports sorting."
> Does this mean LongField/IntField just supports lexicographic order in
> sorting?
> -
> Kumaran R
> On Dec 22, 2016 11:28 PM, "Adrien Grand" <> wrote:
> Le jeu. 22 déc. 2016 à 18:50, Kumaran Ramasubramanian <>
> a écrit :
>> I want to provide sorting, range search and faceting in numeric fields.
>> AFAIK, Purpose of different numeric field types are,
>> NumericDocValuesField supports sorting and faceting
>> LongField/IntField supports range query and sorting
> LongField/IntField only support querying, NumericDocValuesField is the one
> that supports sorting.
> Also note that as of 6.0 LongField and IntField have been replaced with
> LongPoint and IntPoint.
>> 1. Should i duplicate one field in above mentioned types to achieve all
> the
>> three features in numeric?
> Yes. By the way it is perfectly fine to use the same field name for the
> point field and the doc values field.
>> 2. If i am ready to sacrifice faceting, is it advisable to use LongField
>> for sorting and range query?
> Like said above you need doc values for sorting.
>> 3. During sorting, Will NumericDocValuesField( column stride storage)
>> perform better than LongField(trie structure)? If so , should i duplicate
>> field in both 1 and 2 cases?
> Same note here.
> Adrien

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

View raw message