Solr过滤查询缓存和自动装配

时间:2013-03-14 00:35:37

标签: solr

对于solr autowarming,有没有办法自动生成之前执行的过滤查询?

1 个答案:

答案 0 :(得分:1)

是。创建firstSearcher和newSearcher事件监听器,如Solr wiki上所述:http://wiki.apache.org/solr/SolrCaching#newSearcher_and_firstSearcher_Event_Listeners

在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>