CLucene - a full-featured, c++ search engine
API Documentation
#include <IndexSearcher.h>
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::Document * | doc (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::IndexReader * | getReader () |
Query * | rewrite (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 () |
Applications usually need only call the inherited search(Query*) or search(Query*,Filter*) methods.
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 | ( | ) |
void lucene::search::IndexSearcher::close | ( | ) | [virtual] |
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.
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.
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.
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.
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 | ( | ) |
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.