Configuring numerical fields for high-performance sorting and range queries

Let's assume we have Apache Solr deployment where we use range queries. Some of those are run against string fields, while others are run against numerical fields. We identified that our numerical range queries are executing slower than we would like them to run. The usual question arises—is there something that we can do? Of course there is, and this recipe will show you what.

How to do it...

  1. Let's begin with the definition of a field that we use to run our numerical range queries (we add it to the schema.xml file):
    <field name="price" type="float" indexed="true" stored="true"/>
  2. The second step is to define the float field type (again, we add this to the schema.xml file): ...

Get Solr Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.