Save This Page
Home » lucene-2.3.2-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:
    IndexSearcher, ParallelMultiSearcher, CachedDfSource, MultiSearcher

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,   docFreq,   docFreqs,   explain,   explain,   getSimilarity,   maxDoc,   rewrite,   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.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 IOException, CorruptIndexException
 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 final Hits search(Query query) throws IOException 
    Returns the documents matching query.
 public Hits search(Query query,
    Filter filter) throws IOException 
    Returns the documents matching query and filter.
 public Hits search(Query query,
    Sort sort) throws IOException 
    Returns documents matching query sorted by sort.
 public  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.

    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 Hits search(Query query,
    Filter filter,
    Sort sort) throws IOException 
    Returns documents matching query and filter, sorted by sort.
 public  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.
    HitCollector-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) ) is usually more efficient, as it skips non-high-scoring hits.

 public TopDocs search(Query query,
    Filter filter,
    int n) throws IOException 
 abstract public  void search(Weight weight,
    Filter filter,
    HitCollector 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 
    Expert: Low-level 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.

    Applications should usually call Searcher#search(Query,Filter,Sort) instead.

 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.