On May 10, 2006, at 5:31 PM, Chris Hostetter wrote:


: Great question... it should be, as it's created and registered in the
: SolrIndexSearcher constructor.  is the cache .name() returning the
: right thing?

I was just about to ask that. it wasn't untill i started digging into
CacheCOnfig and SolrIndexSearcher because of this thread that i realized it doesn't matter what "name" attribute you give your cache in the config, the SolrCache implimentation itself is responsible for specifying the name that can be used to access the searcher with SolrIndexSearcher.getCache()

if you define your MyCache.name function to be...

   public String name() { return "foo"; }

then even if you have...

     <cache name="facet_cache"
       class="org.foo.MyCache"
     />

...you'll access your cache using the name "foo".

Ah, that was an issue in my code then. I simply had all of the "unnecessary" methods implemented returning a default value (null for Object return values). I now return the value of args.get("name") which is "facet_cache" in my case... but I'm still getting the same NPE.

if you want to pay attention to the name specified i nteh config, that's
the responsability of your init method to get it from the Map or args.

Odd :) But, I've adjusted my code to account for this. Why would you ever want different names than what is specified in the config file? Also, it is confusing because there is a name() and getName() methods required to implement a SolrCache.

        Erik

Reply via email to