com.lucene.search
Class IndexSearcher

java.lang.Object
  |
  +--com.lucene.search.Searcher
        |
        +--com.lucene.search.IndexSearcher

public final class IndexSearcher
extends Searcher

Implements search over a single IndexReader.


Constructor Summary
IndexSearcher(Directory directory)
          Creates a searcher searching the index in the provided directory.
IndexSearcher(IndexReader r)
          Creates a searcher searching the provided index.
IndexSearcher(String path)
          Creates a searcher searching the index in the named directory.
 
Method Summary
 void close()
          Frees resources associated with this Searcher.
 void search(Query query, Filter filter, HitCollector results)
          Lower-level search API.
 void search(Query query, HitCollector results)
          Lower-level search API.
 
Methods inherited from class com.lucene.search.Searcher
search, search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexSearcher

public IndexSearcher(String path)
              throws IOException
Creates a searcher searching the index in the named directory.

IndexSearcher

public IndexSearcher(Directory directory)
              throws IOException
Creates a searcher searching the index in the provided directory.

IndexSearcher

public IndexSearcher(IndexReader r)
Creates a searcher searching the provided index.
Method Detail

close

public final void close()
                 throws IOException
Frees resources associated with this Searcher.
Overrides:
close in class Searcher

search

public final void search(Query query,
                         HitCollector results)
                  throws IOException
Lower-level search API.

HitCollector.collect(int,float) is called for every non-zero scoring document.

Applications should only use this if they need all of the matching documents. The high-level search API (Searcher.search(Query)) is usually more efficient, as it skips non-high-scoring hits.


search

public final void search(Query query,
                         Filter filter,
                         HitCollector results)
                  throws IOException
Lower-level search API.

HitCollector.collect(int,float) is called for every non-zero scoring document.

Applications should only use this if they need all of the matching documents. The high-level search API (Searcher.search(Query)) is usually more efficient, as it skips non-high-scoring hits.