List of usage examples for org.apache.lucene.search IndexSearcher getIndexReader
public IndexReader getIndexReader()
From source file:vtk.repository.index.IndexManager.java
/** * Release a search previously obtained with {@link #getIndexSearcher() }. This * is necessary to free resources and should be done in a <code>finally</code> block * whenever a searcher is used./*w w w. j a v a2 s . c o m*/ * * @param searcher the index searcher. May be <code>null</code>, and in that * case the call does nothing. * * @throws IOException in case of errors with index */ public void releaseIndexSearcher(IndexSearcher searcher) throws IOException { if (searcher == null) return; // Guard against possible NPE at closing time SearcherManager sm = searcherManager; if (sm != null) { sm.release(searcher); } logger.debug("searcher.getIndexReader().getRefCount() = " + searcher.getIndexReader().getRefCount()); }