YongJiang Zhang
YongJiang Zhang

Reputation: 2011

Solr filter query cache and autowarming

For the solr autowarming, is there any way to autowarm the filter queries which are executed before?

Upvotes: 1

Views: 1768

Answers (1)

Andy Lester
Andy Lester

Reputation: 93815

Yes. Create firstSearcher and newSearcher event listeners as documented here on the Solr wiki: http://wiki.apache.org/solr/SolrCaching#newSearcher_and_firstSearcher_Event_Listeners

It will look like this in your solrconfig.xml

<listener event="firstSearcher" class="solr.QuerySenderListener">
  <arr name="queries">
    <!-- seed common sort fields -->
    <lst> <str name="q">anything</str> <str name="sort">name desc, price desc, populartiy desc</str> </lst>
    <!-- seed common facets and filter queries -->
    <lst> <str name="q">anything</str>
          <str name="facet.field">category</str>
          <str name="fq">inStock:true</str>
          <str name="fq">price:[0 TO 100]</str>
    </lst>
  </arr>
</listener>

Upvotes: 1

Related Questions