org.apache.lucene.search
Class IndexSearcher

java.lang.Object
  |
  +--org.apache.lucene.search.Searcher
        |
        +--org.apache.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.
 Document doc(int i)
          For use by HitCollector implementations.
 void search(Query query, Filter filter, HitCollector results)
          Lower-level search API.
 
Methods inherited from class org.apache.lucene.search.Searcher
search, 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

doc

public final Document doc(int i)
                   throws IOException
For use by HitCollector implementations.
Overrides:
doc in class Searcher

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.

Overrides:
search in class Searcher
Parameters:
query - to match documents
filter - if non-null, a bitset used to eliminate some documents
results - to receive hits


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.