I've started down this route, but I'm not sure how to initialize my cache the first time.

I need access to the IndexReader to build the cache, and at this point I don't need any incremental cache updates - if a new IndexSearcher is swapped in, I want to rebuild the cache.

Should I combine a custom SolrCache with a newSearcher listener to have it generated right away? I put in a dummy cache and regenerator, but only see the cache .init() method being called, not the warm() method (on application server startup). How can I bootstrap it such that my cache gets built on app. startup?

Thanks,
        Erik


On May 10, 2006, at 1:20 PM, Yonik Seeley wrote:

Here's an example of the configuration from solrconfig.xml:

<!-- Example of a generic cache. These caches may be accessed by name through SolrIndexSearcher.getCache(),cacheLookup(), and cacheInsert(). The purpose is to enable easy caching of user/application level data. The regenerator argument should be specified as an implementation of solr.search.CacheRegenerator if autowarming is desired. -->
   <!--
   <cache name="myUserCache"
     class="solr.LRUCache"
     size="4096"
     initialSize="1024"
     autowarmCount="1024"
     regenerator="org.mycompany.mypackage.MyRegenerator"
     />
   -->

-Yonik

On 5/10/06, Yonik Seeley <[EMAIL PROTECTED]> wrote:
On 5/10/06, Erik Hatcher <[EMAIL PROTECTED]> wrote:
> I build a "facet" cache in my request handler, but I need it to get
> refreshed when the index changes. How can my custom request handler
> manage this cache and get notified when the index changes?

The easiest way is to let Solr keep the cache (use a custom user cache
defined in the solrconfig.xml) and implement a Regenerator that is
called to create and refresh a new instance when the searcher is
changed.

Does that suit your needs?

-Yonik


Reply via email to