I'm doing a Solr query on a range of values, and for whatever reason, some of my results are outside of my queries range. This seems to work like 75% of the time, but the other 25% seems to be like way off. Why is this?
The field is defined as a string. If you're comparing strings, 25.0
comes after 249
, since the 4
vs the 5
is the sorting criteria.
Define the field as a double field or floating point field and reindex your content. Remember that doubles or floats aren't exact, so if you require exact values, multiply the values by 100 when indexing and store them as integers (or use a currency field, but that field type brings a few other features as well).