Thanks Chris. I dug into the SolrCore code and after reading some of the code I ended up going with core.getNewestSearcher(true) and this fixed the problem.
David On Thu, Mar 24, 2011 at 7:20 PM, Chris Hostetter <hossman_luc...@fucit.org>wrote: > : I am not familiar with Solr internals, so the approach I wanted to take > was > : to basically check the numDocs property of the index during start-up and > set > : a READABLE state in the ZooKeeper node if it's greater than 0. I also > : planned to create a commit hook for replication and updating which > : controlled the READABLE property based on numDocs also. > : > : This just leaves the problem of finding out the number of documents > during > : start-up. I planned to have something like: > > Most of the ZK stuff you mentioned is over my head, but i get the general > gist of what you want: > > * a hook on startup that checks numDocs > * if not empty, trigger some logic > > My suggestion would be to implement this as a "firstSearcher" > SolrEventListener. when that runs, you'll have easy access to a > SOlrIndexSearcher (and you won't even have to refcount it) and you can > fire whatever logic you want based on what you find when looking at it. > > > -Hoss >