lucene - SOLR range query for fraction numbers no going to work properly -
i have field in solr contains fraction value 1.2, 0.523, 4.7 etc. field defined like
<field name="ratio" type="float" stored="true" indexed="true"/> in order search range 0.2 1, using following query
http://localhost:8983/solr/collection1/select?q=bag&df=keywords&wt=json&indent=true&group=true&group.field=ratio&fq=ratio:[0.2 1] but results obtained contain ratio grater 1. problem in query.
note: have group on field why applied grouping also. not worry it
the float field type in solr has odd behavior when comes range queries...
field values sort numerically, range queries (and other features rely on numeric ranges) not work expected: values evaluated in unicode string order, not numeric order.
from: http://lucene.apache.org/solr/4_10_4/solr-core/org/apache/solr/schema/floatfield.html
what want use equivalent trie field in case trie float. field should defined follows...
<field name="ratio" type="tfloat" stored="true" indexed="true"/> make sure re-index after changing schema , try range queries again.
Comments
Post a Comment