Example usage for org.apache.lucene.search IndexSearcher getIndexReader

List of usage examples for org.apache.lucene.search IndexSearcher getIndexReader

Introduction

In this page you can find the example usage for org.apache.lucene.search IndexSearcher getIndexReader.

Prototype

public IndexReader getIndexReader() 

Source Link

Document

Return the IndexReader this searches.

Usage

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());
}