Consider the warning on the NumericUtils API
NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
I've noticed this becoming a problem for some people, since the NumericUtils API did indeed change significantly from Version 3.6 to Version 4.0. I would recommend avoiding using it directly.
Instead, use a NumericRangeQuery to search for numeric values. Precise matches can be obtained by setting maximum and minimum ranges to equal values.
Also, deliberately selecting which fields should be numeric may be helpful. NumericFields are designed to allow numeric range querying and sorting. If you don't need to search using it as a numeric value, it probably shouldn't be a NumericField. Identification numbers, for instance, generally should be keywords, not numbers.
Read full article from long integer - Lucene LongField exact search with Query - Stack Overflow
No comments:
Post a Comment