Home » lucene-3.0.1-src » org.apache » lucene » search » [javadoc | source]
org.apache.lucene.search
abstract public class: Searcher [javadoc | source]
java.lang.Object
   org.apache.lucene.search.Searcher

All Implemented Interfaces:
    Searchable

Direct Known Subclasses:
    MultiSearcher, ParallelMultiSearcher, CachedDfSource, IndexSearcher

An abstract base class for search implementations. Implements the main search methods.

Note that you can only access hits from a Searcher as long as it is not yet closed, otherwise an IOException will be thrown.
Method from org.apache.lucene.search.Searcher Summary:
close,   createWeight,   doc,   doc,   docFreq,   docFreqs,   explain,   explain,   getSimilarity,   maxDoc,   rewrite,   search,   search,   search,   search,   search,   search,   search,   search,   setSimilarity
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.search.Searcher Detail:
 abstract public  void close() throws IOException
 protected Weight createWeight(Query query) throws IOException 
    creates a weight for query
 abstract public Document doc(int i) throws CorruptIndexException, IOException
 abstract public Document doc(int docid,
    FieldSelector fieldSelector) throws CorruptIndexException, IOException
 abstract public int docFreq(Term term) throws IOException
 public int[] docFreqs(Term[] terms) throws IOException 
 public Explanation explain(Query query,
    int doc) throws IOException 
    Returns an Explanation that describes how doc scored against query.

    This is intended to be used in developing Similarity implementations, and, for good performance, should not be displayed with every hit. Computing an explanation is as expensive as executing the query over the entire index.

 abstract public Explanation explain(Weight weight,
    int doc) throws IOException
 public Similarity getSimilarity() 
    Expert: Return the Similarity implementation used by this Searcher.

    This defaults to the current value of Similarity#getDefault() .

 abstract public int maxDoc() throws IOException
 abstract public Query rewrite(Query query) throws IOException
 public  void search(Query query,
    Collector results) throws IOException 
    Lower-level search API.

    Collector#collect(int) is called for every matching document.

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

    Note: The score passed to this method is a raw score. In other words, the score will not necessarily be a float whose value is between 0 and 1.

 public TopDocs search(Query query,
    int n) throws IOException 
    Finds the top n hits for query.
 public  void search(Query query,
    Filter filter,
    Collector results) throws IOException 
    Lower-level search API.

    Collector#collect(int) is called for every matching document.
    Collector-based access to remote indexes is discouraged.

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

 public TopDocs search(Query query,
    Filter filter,
    int n) throws IOException 
    Finds the top n hits for query, applying filter if non-null.
 abstract public  void search(Weight weight,
    Filter filter,
    Collector results) throws IOException
 abstract public TopDocs search(Weight weight,
    Filter filter,
    int n) throws IOException
 public TopFieldDocs search(Query query,
    Filter filter,
    int n,
    Sort sort) throws IOException 
    Search implementation with arbitrary sorting. Finds the top n hits for query, applying filter if non-null, and sorting the hits by the criteria in sort.

    NOTE: this does not compute scores by default; use IndexSearcher#setDefaultFieldSortScoring to enable scoring.

 abstract public TopFieldDocs search(Weight weight,
    Filter filter,
    int n,
    Sort sort) throws IOException
 public  void setSimilarity(Similarity similarity) 
    Expert: Set the Similarity implementation used by this Searcher.