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


lucene::search::Hits Class Reference

A ranked list of documents, used to hold search results. More...

#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::Documentdoc (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.


Detailed Description

A ranked list of documents, used to hold search results.

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


Constructor & Destructor Documentation

lucene::search::Hits::Hits ( Searcher s,
Query q,
Filter f,
const Sort sort = NULL 
)

lucene::search::Hits::~Hits (  ) 


Member Function Documentation

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.

Memory management:
Memory belongs to the hits object. Don't delete the return value.

int32_t lucene::search::Hits::id ( const int32_t  n  ) 

Returns the id for the nth document in this set.

Note that ids may change when the index changes, so you cannot rely on the id to be stable.

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.


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

clucene.sourceforge.net