CLucene - a full-featured, c++ search engine
API Documentation
#include <Hits.h>
Public Member Functions | |
Hits (Searcher *s, Query *q, Filter *f, const Sort *sort=NULL) | |
~Hits () | |
int32_t | length () const |
Returns the total number of hits available in this set. | |
lucene::document::Document & | doc (const int32_t n) |
Returns the stored fields of the nth document in this set. | |
int32_t | id (const int32_t n) |
Returns the id for the nth document in this set. | |
float_t | score (const int32_t n) |
Returns the score for the nth document in this set. | |
int32_t | countDeletions (lucene::search::Searcher *s) |
count # deletions, return -1 if unknown. |
Caution: Iterate only over the hits needed. Iterating over all hits is generally not desirable and may be the source of performance issues. If you need to iterate over many or all hits, consider using the search method that takes a HitCollector.
Note: Deleting matching documents concurrently with traversing the hits, might, when deleting hits that were not yet retrieved, decrease length(). In such case, ConcurrentModificationException is thrown when accessing hit n
current_length() (but n
< length()_at_start).
lucene::search::Hits::~Hits | ( | ) |
int32_t lucene::search::Hits::length | ( | ) | const |
Returns the total number of hits available in this set.
lucene:: document ::Document& lucene::search::Hits::doc | ( | const int32_t | n | ) |
Returns the stored fields of the nth document in this set.
Documents are cached, so that repeated requests for the same element may return the same Document object.
int32_t lucene::search::Hits::id | ( | const int32_t | n | ) |
float_t lucene::search::Hits::score | ( | const int32_t | n | ) |
Returns the score for the nth document in this set.
int32_t lucene::search::Hits::countDeletions | ( | lucene::search::Searcher * | s | ) |
count # deletions, return -1 if unknown.