Imagine a situation where you stored the data about the companies and their localization in the Solr index. There are two fields that you use to show the faceting results for the user — the city in which the company is located and the state in which the company is located. Is there a way to boost the performance of that kind of a query? Yes there is! And this recipe will show you show to do it.
Before you continue reading this recipe, please take the time to read the recipe How to have two different facet limits for two different fields in the same query discussed in Chapter 6, Using Faceting Mechanism.
Let's assume that besides the search field, we have two additional fields in our index, whose definition looks similar to the following:
<field name="facetCity" type="string" indexed="true" stored="true"/> <field name="facetState" type="string" indexed="true" stored="true"/>
So the actual query to show the search results and...