CLucene - a full-featured, c++ search engine
API Documentation


lucene::search::Searchable Class Reference

The interface for search implementations. More...

#include <Searchable.h>

Inheritance diagram for lucene::search::Searchable:

lucene::search::Searcher lucene::search::IndexSearcher lucene::search::MultiSearcher

Public Member Functions

virtual ~Searchable ()
virtual void _search (Query *query, Filter *filter, HitCollector *results)=0
 Lower-level search API.
virtual void close ()=0
 Frees resources associated with this Searcher.
virtual int32_t docFreq (const lucene::index::Term *term) const =0
 Expert: Returns the number of documents containing term.
virtual int32_t maxDoc () const =0
 Expert: Returns one greater than the largest possible document number.
virtual TopDocs_search (Query *query, Filter *filter, const int32_t n)=0
 Expert: Low-level search implementation.
virtual bool doc (int32_t i, lucene::document::Document *d)=0
 Expert: Returns the stored fields of document i.
lucene::document::Documentdoc (const int32_t i)
virtual Queryrewrite (Query *query)=0
 Expert: called to re-write queries into primitive queries.
virtual void explain (Query *query, int32_t doc, Explanation *ret)=0
 Returns an Explanation that describes how doc scored against query.
virtual TopFieldDocs * _search (Query *query, Filter *filter, const int32_t n, const Sort *sort)=0
 Expert: Low-level search implementation with arbitrary sorting.

Detailed Description

The interface for search implementations.

Implementations provide search over a single index, over multiple indices, and over indices on remote servers.


Constructor & Destructor Documentation

virtual lucene::search::Searchable::~Searchable (  )  [virtual]


Member Function Documentation

virtual void lucene::search::Searchable::_search ( Query query,
Filter filter,
HitCollector results 
) [pure virtual]

Lower-level search API.

HitCollector#collect(int32_t,float_t) 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.

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

Implemented in lucene::search::IndexSearcher, lucene::search::MultiSearcher, and lucene::search::Searcher.

virtual void lucene::search::Searchable::close (  )  [pure virtual]

Frees resources associated with this Searcher.

Be careful not to call this method while you are still using objects like Hits.

Implemented in lucene::search::IndexSearcher, and lucene::search::MultiSearcher.

virtual int32_t lucene::search::Searchable::docFreq ( const lucene::index::Term term  )  const [pure virtual]

Expert: Returns the number of documents containing term.

Called by search code to compute term weights.

See also:
IndexReader::docFreq(Term).

Implemented in lucene::search::IndexSearcher, and lucene::search::MultiSearcher.

virtual int32_t lucene::search::Searchable::maxDoc (  )  const [pure virtual]

Expert: Returns one greater than the largest possible document number.

Called by search code to compute term weights.

See also:
IndexReader::maxDoc().

Implemented in lucene::search::IndexSearcher, and lucene::search::MultiSearcher.

virtual TopDocs* lucene::search::Searchable::_search ( Query query,
Filter filter,
const int32_t  n 
) [pure virtual]

Expert: Low-level search implementation.

Finds the top n hits for query, applying filter if non-null.

Called by Hits.

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

Implemented in lucene::search::IndexSearcher, and lucene::search::MultiSearcher.

virtual bool lucene::search::Searchable::doc ( int32_t  i,
lucene::document::Document d 
) [pure virtual]

Expert: Returns the stored fields of document i.

Called by HitCollector implementations.

See also:
IndexReader::document(int32_t).

Implemented in lucene::search::IndexSearcher, and lucene::search::MultiSearcher.

lucene:: document ::Document* lucene::search::Searchable::doc ( const int32_t  i  ) 

Reimplemented in lucene::search::IndexSearcher.

virtual Query* lucene::search::Searchable::rewrite ( Query query  )  [pure virtual]

Expert: called to re-write queries into primitive queries.

Implemented in lucene::search::IndexSearcher, and lucene::search::MultiSearcher.

virtual void lucene::search::Searchable::explain ( Query query,
int32_t  doc,
Explanation ret 
) [pure virtual]

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.

Implemented in lucene::search::IndexSearcher, and lucene::search::MultiSearcher.

virtual TopFieldDocs* lucene::search::Searchable::_search ( Query query,
Filter filter,
const int32_t  n,
const Sort sort 
) [pure virtual]

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.

Implemented in lucene::search::IndexSearcher, and lucene::search::MultiSearcher.


The documentation for this class was generated from the following file:

clucene.sourceforge.net