Let's assume we have the Apache Solr 4.0 deployment where we use range queries. Some of those are run against string fields, while others are run against numerical fields. Using different techniques, we identified that our numerical range queries execute slower than we would like. The usual question arises – is there something that we can do ? Of course, and this recipe will show you what.
The following steps will explain how we can control the order of execution of numericalrange queries:
Let's begin with the definition of a field that we use to run our numerical range queries:
<field name="price" type="float" indexed="true" stored="true"/>
The second step is to define the float field type:
<fieldType name="float" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
Now the usual query that is run against the preceding field is as follows:
q=*:*&fq=price:[10.0+TO+59.00]&facet=true&facet...