You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2008/02/07 06:14:38 UTC

[Solr Wiki] Update of "SolrCaching" by HossMan

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The following page has been changed by HossMan:
http://wiki.apache.org/solr/SolrCaching

------------------------------------------------------------------------------
  
  You can specify a regenerator for any of the cache types here, but !SolrIndexSearcher itself specifies the regenerators that Solr uses internally.
  
+ == The Lucene FieldCache ==
+ 
+ Lucene has a low level "Field``Cache" which is used for sorting (and in some cases faceting).  This cache is not managed by Solr it has no configuration options and cannot be autowarmed -- it is initialized the first time it is used for each Searcher.
+ 
+ See below for ways you can "explicitly warm" the Field``Cache using newSearcher and firstSearcher event listeners.
+ 
  = Other Cache-relevant Settings =
+ 
+ == newSearcher and firstSearcher Event Listeners ==
+ 
+ A firstSearcher event is fired whenever a new searcher is being prepared but there is no current registered searcher to handle requests or to gain autowarming data from (ie: on Solr startup).  A newSearcher event is fired whenever a new searcher is being prepared and there is a current searcher handling requests (aka registered).
+ 
+ In both cases, a Solr``Event``Listener (like the Query``Sender``Listener) may be configured in the [wiki:SolrConfigXml solrconfig.xml] file -- This is particularly useful to "explicitly warm" caches up with common queries on startup, and to forcibly create the Field``Cache for common sort fields when new searchers are opened...
+ 
+ {{{
+     <listener event="newSearcher" 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>
+       </arr>
+     </listener>
+     <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>
+ }}}
  
  == useFilterForSortedQuery ==