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


lucene::search::IndexSearcher Class Reference

Implements search over a single IndexReader. More...

#include <IndexSearcher.h>

Inheritance diagram for lucene::search::IndexSearcher:

lucene::search::Searcher lucene::search::Searchable

Public Member Functions

 IndexSearcher (const char *path)
 Creates a searcher searching the index in the named directory.
 IndexSearcher (lucene::store::Directory *directory)
 Creates a searcher searching the index in the specified directory.
 IndexSearcher (lucene::index::IndexReader *r)
 Creates a searcher searching the provided index.
 ~IndexSearcher ()
void close ()
 Frees resources associated with this Searcher.
int32_t docFreq (const lucene::index::Term *term) const
 Expert: Returns the number of documents containing term.
bool doc (int32_t i, lucene::document::Document *document)
 Expert: Returns the stored fields of document i.
lucene::document::Documentdoc (int32_t i)
int32_t maxDoc () const
 Expert: Returns one greater than the largest possible document number.
TopDocs_search (Query *query, Filter *filter, const int32_t nDocs)
 Expert: Low-level search implementation.
TopFieldDocs * _search (Query *query, Filter *filter, const int32_t nDocs, const Sort *sort)
 Expert: Low-level search implementation with arbitrary sorting.
void _search (Query *query, Filter *filter, HitCollector *results)
 Lower-level search API.
lucene::index::IndexReadergetReader ()
Queryrewrite (Query *original)
 Expert: called to re-write queries into primitive queries.
void explain (Query *query, int32_t doc, Explanation *ret)
 Returns an Explanation that describes how doc scored against query.
virtual const TCHAR * getClassName ()

Detailed Description

Implements search over a single IndexReader.

Applications usually need only call the inherited search(Query*) or search(Query*,Filter*) methods.


Constructor & Destructor Documentation

lucene::search::IndexSearcher::IndexSearcher ( const char *  path  ) 

Creates a searcher searching the index in the named directory.

lucene::search::IndexSearcher::IndexSearcher ( lucene::store::Directory directory  ) 

Creates a searcher searching the index in the specified directory.

lucene::search::IndexSearcher::IndexSearcher ( lucene::index::IndexReader r  ) 

Creates a searcher searching the provided index.

lucene::search::IndexSearcher::~IndexSearcher (  ) 


Member Function Documentation

void lucene::search::IndexSearcher::close (  )  [virtual]

Frees resources associated with this Searcher.

Implements lucene::search::Searchable.

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

Expert: Returns the number of documents containing term.

Called by search code to compute term weights.

See also:
IndexReader::docFreq(Term).

Implements lucene::search::Searchable.

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

Expert: Returns the stored fields of document i.

Called by HitCollector implementations.

See also:
IndexReader::document(int32_t).

Implements lucene::search::Searchable.

lucene:: document ::Document* lucene::search::IndexSearcher::doc ( int32_t  i  ) 

Reimplemented from lucene::search::Searchable.

int32_t lucene::search::IndexSearcher::maxDoc (  )  const [virtual]

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

Called by search code to compute term weights.

See also:
IndexReader::maxDoc().

Implements lucene::search::Searchable.

TopDocs* lucene::search::IndexSearcher::_search ( Query query,
Filter filter,
const int32_t  n 
) [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.

Implements lucene::search::Searchable.

TopFieldDocs* lucene::search::IndexSearcher::_search ( Query query,
Filter filter,
const int32_t  n,
const Sort sort 
) [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.

Implements lucene::search::Searchable.

void lucene::search::IndexSearcher::_search ( Query query,
Filter filter,
HitCollector results 
) [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

Implements lucene::search::Searcher.

lucene:: index ::IndexReader* lucene::search::IndexSearcher::getReader (  ) 

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

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

Implements lucene::search::Searchable.

void lucene::search::IndexSearcher::explain ( Query query,
int32_t  doc,
Explanation ret 
) [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.

Implements lucene::search::Searchable.

virtual const TCHAR* lucene::search::IndexSearcher::getClassName (  )  [virtual]

Reimplemented from lucene::search::Searcher.


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

clucene.sourceforge.net