Re: problems with custom SolrCache.init() - fails on startup

2010-12-09 Thread Chris Hostetter

: I believe the problem is that I attempt to access the core in the init 
process. 
: I currently use the deprecated SolrCore.getSolrCore(), but had the same 
problem 
: when attempting to use CoreContainer. During some initialization process, I 
need 
: access to the IndexSchema object. I assume the problem is because startup 
must 
: create objects in a different order now.
: 
: Does anyone have any suggestions on how to get access to the core 
infrastructure 
: at the startup of the caches?

Hmmm... i don't think there was ever any expectation that SolrCache's 
would have access to the SolrCore durring init -- but obviously with the 
abomination thtawas SolrCore.getSolrCore() anything was possible.  In 
general the number of things that have access to the SolrCore during 
"init" is extremely low because the SOlrCore itself is what's initializing 
everything else -- even in 1.3 calling SolrCore.getSolrCore() during 
SolrCache's init() method was likely to give you a SolrCore object that 
wasn't fully formed.

If what really matters to you is getting the IndexSchema, my suggestion 
would be to take whatever custom code you have in your init method and 
move it into a SolrEventListener that you then wire up to the 
firstSearcher/newSearcher events - it can ask the searcher for both the 
IndexSchema and the cache object (by name) and then populate it as needed.

(then you might not even need a custom subclass - you can probably use 
FastLRUCache as is)




-Hoss


problems with custom SolrCache.init() - fails on startup

2010-12-01 Thread Kevin Osborn
My project has a couple custom caches that descend from FastLRUCache. These 
worked fine in Solr 1.3. Then I started migrating my project to Solr 1.4.1 and 
had problems during startup.

I believe the problem is that I attempt to access the core in the init process. 
I currently use the deprecated SolrCore.getSolrCore(), but had the same problem 
when attempting to use CoreContainer. During some initialization process, I 
need 
access to the IndexSchema object. I assume the problem is because startup must 
create objects in a different order now.

Does anyone have any suggestions on how to get access to the core 
infrastructure 
at the startup of the caches?