gate.creole.annic.apache.lucene.search
Class Searcher

java.lang.Object
  extended by gate.creole.annic.apache.lucene.search.Searcher
All Implemented Interfaces:
Searchable, Remote
Direct Known Subclasses:
IndexSearcher

public abstract class Searcher
extends Object
implements Searchable

An abstract base class for search implementations. Implements some common utility methods.


Constructor Summary
Searcher()
           
 
Method Summary
 Similarity getSimilarity()
          Expert: Return the Similarity implementation used by this Searcher.
 Hits search(Query query)
          Returns the documents matching query.
 Hits search(Query query, Filter filter)
          Returns the documents matching query and filter.
 Hits search(Query query, Filter filter, Sort sort)
          Returns documents matching query and filter, sorted by sort.
 void search(Query query, HitCollector results)
          Lower-level search API.
 Hits search(Query query, Sort sort)
          Returns documents matching query sorted by sort.
 void setSimilarity(Similarity similarity)
          Expert: Set the Similarity implementation used by this Searcher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.creole.annic.apache.lucene.search.Searchable
close, doc, docFreq, explain, maxDoc, rewrite, search, search, search
 

Constructor Detail

Searcher

public Searcher()
Method Detail

search

public final Hits search(Query query)
                  throws IOException
Returns the documents matching query.

Throws:
IOException

search

public Hits search(Query query,
                   Filter filter)
            throws IOException
Returns the documents matching query and filter.

Throws:
IOException

search

public Hits search(Query query,
                   Sort sort)
            throws IOException
Returns documents matching query sorted by sort.

Throws:
IOException

search

public Hits search(Query query,
                   Filter filter,
                   Sort sort)
            throws IOException
Returns documents matching query and filter, sorted by sort.

Throws:
IOException

search

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 (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.

Throws:
IOException

setSimilarity

public void setSimilarity(Similarity similarity)
Expert: Set the Similarity implementation used by this Searcher.

See Also:
Similarity.setDefault(Similarity)

getSimilarity

public Similarity getSimilarity()
Expert: Return the Similarity implementation used by this Searcher.

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