On 6/5/2014 3:39 PM, Aman Tandon wrote:
> Thanks to all.
> And as Solr provides the field datatype as int as well as solr.TrieIntField
> so which one is more better?

The example has "int" and "tint" as two different types that both use
TrieIntField.  The difference between the two is the precisionStep value.

The "int" type has a precisionStep of zero, which basically turns off
that feature and results in only one value (the actual number) in the
index.  This is the most efficient in terms of space, and the type you
should be using if you do not need range queries.

The "tint" type has a precisionStep of 8, which means that it will store
additional values in the index at lower precisions, in 8 bit
increments.  This can greatly speed up range queries as described in the
Javadoc for this Lucene class:

https://lucene.apache.org/core/4_8_1/core/org/apache/lucene/search/NumericRangeQuery.html

This javadoc is fairly technical and honestly doesn't explain it well. 
The following excerpt from the full paper by Uwe Schindler does a
reasonably good job of explaining how it works.  This example has a
base-10 precisionStep of one digit, whereas the Lucene implementation
has a precisionStep defined in terms of base-2 digits (bits).

https://www.dropbox.com/s/7996yacdxv56ehd/trie-explanation.png

Thanks,
Shawn

Reply via email to