lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: RequestHandler / function Query with Cache-implementation
Date Tue, 27 Apr 2010 19:22:00 GMT

: during several thoughts about how to make scoring in Solr better, a lot of
: times I wished that I can use precomputed data to influence score. However,
: this data could change whenever there occurs a commit. That's why I can't
: work with preprocessing while indexing the documents. I hope to solve this
: problem with the help of a function Query that stores computed metadata in a
: cache, if it isn't already computed.

I'm not entirely sure i undestand what you're asking, but have you looked 
at ExternalFileField ? ... what you are describing sounds an awful lot 
like using it in a FunctionQuery

: I will implement a method that instantiates a SolrJ-client to send some
: queries to the index. The responsed data is important to compute the needed
: metadata for my functionQuery. 
: Once the metadata is computed, I want to store it in a SolrCache.
: - Here is my first question: I can't find any code-snippet that shows how to
: deal with SolrCache - do you know some classes that implement caches which
: get renewed after updating (and commiting) the index?
: - Is it possible to create this cache while Solr is starting? If not, I
: would think of a cronJob or something like that to warmUp the cache when
: Solr starts the first time.

I don't really understand wherey you intend SolrJ to fit into this 
picture, but you can declare any custom instances of a SolrCache that you 
want in your solrconfig.xml (there is an example commented out in the 
example solrconfig.xml -- look for "myUserCache") which you can then 
access in any custom plugin you want using SolrIndexSearcher (getCache, 
cacheInsert, cacheLookup, etc... any of hte cache methods that take a 

You can also configure a CacheRegenerator with whatever logic you want for 
populating a new cache instance based on the contents of the old cache 
instance whenever a newSearcher is warmed -- this is all configured in 

As far as pre-populating the cacce on startup -- you can do that by 
implementing a SolrEventListener that implements newSearcher and 
registering in solrconfig.xml it to only recieve "firstSearcher" events 
(triggered once on startup).

I've implemented some custom metadata caches (for driving complex 
faceting) like this, but i'm afraid i can't share the code examples.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message