This is convincing me... I'd like to experiment and close. So, how can I be sure this is the right thing? I would have thought adding a document and committing would have created a Searcher in my current usage but I do not see the reference list actually being enlarged on my development machine.
What would create a new one? paul Le 6 août 2011 à 20:04, Paul Libbrecht a écrit : > > Le 6 août 2011 à 19:52, Yonik Seeley a écrit : > >>> I've been using the following: >>> rb.req.getCore().getSearcher().get().getReader() >> >> Bingo! Code should never do core.getSearcher().get() >> since core.getSearcher returns a reference that must be decremented >> when you are done. >> >> Using req.getSearcher() is much easier since it ensures that the >> searcher never changes during the scope of a single request >> and it handles decrementing the reference when the request is closed. > > When you say "decrementing" you do also mean dereference? > (seems to be from the RefCounted class which would dereference when ref-count > is zero) > > I also see the javadoc of SolrCore.getSearcher() is quite explicit there. > > I would suggest to add a display of the closed-ness-status of the reader in > the stats.jsp. > Most likely all these searchers have a closed reader and one would see the > bug. > > paul