You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Grant Ingersoll <gs...@apache.org> on 2010/10/29 23:36:41 UTC

SolrCore.getSearcher() and postCommit()

Is it OK to call and increment a Searcher ref (i.e. SolrCore.getSearcher()) in a SolrEventListener.postCommit() hook as long as I decrement it when I am done?  I need to get a handle on an IndexReader so I can dump out a portion of the index to an external process.

Thanks,
Grant

Re: SolrCore.getSearcher() and postCommit()

Posted by Grant Ingersoll <gs...@apache.org>.
On Oct 29, 2010, at 5:48 PM, Yonik Seeley wrote:

> On Fri, Oct 29, 2010 at 5:36 PM, Grant Ingersoll <gs...@apache.org> wrote:
>> Is it OK to call and increment a Searcher ref (i.e. SolrCore.getSearcher()) in a SolrEventListener.postCommit() hook as long as I decrement it when I am done?  I need to get a handle on an IndexReader so I can dump out a portion of the index to an external process.
> 
> Yes, just be aware that the searcher you will get will not contain the
> recently committed documents.
> If you want that, look at the newSearcher hook instead.

Ah, good point.  I do need that.  Also, the newSearcher event makes it easier since I don't have to worry about refcounting it.  Thanks, Yonik!

-Grant

Re: SolrCore.getSearcher() and postCommit()

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Fri, Oct 29, 2010 at 5:36 PM, Grant Ingersoll <gs...@apache.org> wrote:
> Is it OK to call and increment a Searcher ref (i.e. SolrCore.getSearcher()) in a SolrEventListener.postCommit() hook as long as I decrement it when I am done?  I need to get a handle on an IndexReader so I can dump out a portion of the index to an external process.

Yes, just be aware that the searcher you will get will not contain the
recently committed documents.
If you want that, look at the newSearcher hook instead.

-Yonik
http://www.lucidimagination.com