DataStax Help Center

Tuning Solr facet queries with warmers


Heavy and concurrent use of facet queries on Solr, particularly on fields with high cardinality, can acquire high latency when auto soft commit is triggered.  Setting up new searchers to warm your facet queries will improve response times.  However, with facet queries, this is an all or none scenario and you will need to set up warming queries on all your facet queries for it to be effective.


The reason for this is that after each commit/flush the new searcher needs to reload from a data structure on disk.  There is no concurrency on this operation.  Even if you have some of the facet queries warmed they will still contend with non-warmed queries and you won't see performance benefit.


Setting up a warming query for all your facets resolves this performance issue.  After each commit/flush the warmers will get executed one by one while current queries run on the old warmed searchers.  To mitigate high use of memory by the warmers it is best to limit the facet, for instance to 1, and to restrict the search if possible.


The below is a simplified example implementation.

Excerpt from schema.xml

<field name="title"  type="text" indexed="true"  stored="true"/>
<field name="topic"  type="text" indexed="true"  stored="true"/>
<field name="subject"  type="text" indexed="true"  stored="true"/>



Excerpt from solrconfig.xml

<listener event="newSearcher" class="solr.QuerySenderListener"> 
<arr name="queries"> 

<lst><str name="q">prewarmQuery</str> 
<str name="facet">true</str> 
<str name="facet.limit">1</str> 
<str name="facet.field">topic</str></lst>

<lst><str name="q">prewarmQuery</str> 
<str name="facet">true</str> 
<str name="facet.limit">1</str> 
<str name="facet.field">title</str></lst> 

<lst><str name="q">prewarmQuery</str> 
<str name="facet">true</str> 
<str name="facet.limit">1</str> 
<str name="facet.field">subject</str></lst> 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk