Reputation: 97
What exactly is Precision step.
I am new to lucene and had some difficulty in understanding the concept of precision step,used in Numeric Field and NumericRangeQuery. After going through lucene docs and different stackoverflow questions I got the concept. Now I am sharing here my understanding and explanation.I hope it will help others in fast and easy understanding of Precision Step. This is open for discussion and correction. Please add your precious knowledge here and help this to improve.
Upvotes: 0
Views: 352
Reputation: 97
Precision Step
Since Lucene deals with only Strings datatype more exactly. All Datatypes are converted to string and then processed further.For numeric fields and queries lucene has developed a string manipulation of numbers. The string of numbers are processed and queried accordingly.Precision step/ value is used here for indexing terms and query optimization.
Precision step is a count that after how many bits of indexed value a new term starts.
For example. In case of an int of 32 bits. Precision step of 26 will give two terms.
32 bit itself and 32-26=4 bit
Similarly Precision step of 8 will create 4 terms in total
Thus if we have lower value of precision step, there will be more precisions and more terms in index. And maximum number of terms to match will increase resulting in improved results.
Shortly Lower Precision Step value => More Precision => More terms => Increased Terms for matching => Improved Results.
Upvotes: 1