lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Custom HitCollector with SolrIndexSearcher and caching
Date Sat, 19 May 2007 20:42:33 GMT

: But somehow this "add an additional parameter everywhere" doesn't sound

it's certianly not a pretty solution, it's just the most general one i
could think of at the time.

: right.  I wish I could write my own WeightedSolrIndexSearcher that
: extends SolrSearcher and call some hook methods from SolrIndexSearcher
: to hook into caching (both get and set).

writing your own subclass wouldn't hard ... what would be tricky is making
sure your subclass is used whenever anyone does a search, and more
importantly (since you want to take advantage of the caching) making sure
that openining a new reader results in your class being instantiated and
used to warm the caches.

if you're willing to say that you only care about your
WeightedSolrIndexSearcher being used in custom request handlers where you
specificly refer to it (and things like StandardRequestHandler will
continue to use SolrIndexSearcher) then you could make
WeightedSolrIndexSearcher be a proxy class that wraps a
SolrIndexSearcher but uses it's own specially named caches (instead of
hte default filterCache and queryResultCache) and have CacheRegenerators
configured for them that know to wrap each newSearcher in a
WeightedSolrIndexSearcher before autowarming.  then all that's left to do
is make your custom request handlers wrap the searcher associated with
each request in an instance of WeightedSolrIndexSearcher as well.


View raw message