Save This Page
Home » lucene-2.4.1-src » org.apache » lucene » search » [javadoc | source]
org.apache.lucene.search
public class: IndexSearcher [javadoc | source]
java.lang.Object
   org.apache.lucene.search.Searcher
      org.apache.lucene.search.IndexSearcher

All Implemented Interfaces:
    Searchable

Implements search over a single IndexReader.

Applications usually need only call the inherited #search(Query) or #search(Query,Filter) methods. For performance reasons it is recommended to open only one IndexSearcher and use it for all of your searches.

Note that you can only access Hits from an IndexSearcher as long as it is not yet closed, otherwise an IOException will be thrown.
Field Summary
 IndexReader reader     
Constructor:
 public IndexSearcher(String path) throws IOException, CorruptIndexException 
    Creates a searcher searching the index in the named directory.
    Throws:
    CorruptIndexException - if the index is corrupt
    IOException - if there is a low-level IO error
 public IndexSearcher(Directory directory) throws IOException, CorruptIndexException 
    Creates a searcher searching the index in the provided directory.
    Throws:
    CorruptIndexException - if the index is corrupt
    IOException - if there is a low-level IO error
 public IndexSearcher(IndexReader r) 
    Creates a searcher searching the provided index.
Method from org.apache.lucene.search.IndexSearcher Summary:
close,   doc,   doc,   docFreq,   explain,   getIndexReader,   maxDoc,   rewrite,   search,   search,   search
Methods from org.apache.lucene.search.Searcher:
close,   createWeight,   doc,   docFreq,   docFreqs,   explain,   explain,   getSimilarity,   maxDoc,   rewrite,   search,   search,   search,   search,   search,   search,   search,   search,   search,   search,   search,   search,   setSimilarity
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.search.IndexSearcher Detail:
 public  void close() throws IOException 
    Note that the underlying IndexReader is not closed, if IndexSearcher was constructed with IndexSearcher(IndexReader r). If the IndexReader was supplied implicitly by specifying a directory, then the IndexReader gets closed.
 public Document doc(int i) throws IOException, CorruptIndexException 
 public Document doc(int i,
    FieldSelector fieldSelector) throws IOException, CorruptIndexException 
 public int docFreq(Term term) throws IOException 
 public Explanation explain(Weight weight,
    int doc) throws IOException 
 public IndexReader getIndexReader() 
 public int maxDoc() throws IOException 
 public Query rewrite(Query original) throws IOException 
 public TopDocs search(Weight weight,
    Filter filter,
    int nDocs) throws IOException 
 public  void search(Weight weight,
    Filter filter,
    HitCollector results) throws IOException 
 public TopFieldDocs search(Weight weight,
    Filter filter,
    int nDocs,
    Sort sort) throws IOException