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


lucene::search::ScoreDocComparator Class Reference

Expert: Compares two ScoreDoc objects for sorting. More...

#include <Sort.h>

Inheritance diagram for lucene::search::ScoreDocComparator:

lucene::search::ScoreDocComparators::Float lucene::search::ScoreDocComparators::IndexOrder lucene::search::ScoreDocComparators::Int32 lucene::search::ScoreDocComparators::Relevance lucene::search::ScoreDocComparators::String

Public Member Functions

virtual ~ScoreDocComparator ()
virtual int32_t compare (struct ScoreDoc *i, struct ScoreDoc *j)=0
 Compares two ScoreDoc objects and returns a result indicating their sort order.
virtual lucene::util::ComparablesortValue (struct ScoreDoc *i)=0
 Returns the value used to sort the given document.
virtual int32_t sortType ()=0
 Returns the type of sort.

Static Public Attributes

static ScoreDocComparatorRELEVANCE
 Special comparator for sorting hits according to computed relevance (document score).
static ScoreDocComparatorINDEXORDER
 Special comparator for sorting hits according to index order (document number).

Protected Member Functions

 ScoreDocComparator ()

Detailed Description

Expert: Compares two ScoreDoc objects for sorting.

Constructor & Destructor Documentation

lucene::search::ScoreDocComparator::ScoreDocComparator (  )  [inline, protected]

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


Member Function Documentation

virtual int32_t lucene::search::ScoreDocComparator::compare ( struct ScoreDoc i,
struct ScoreDoc j 
) [pure virtual]

Compares two ScoreDoc objects and returns a result indicating their sort order.

Parameters:
i First ScoreDoc
j Second ScoreDoc
Returns:
-1 if i should come before j
1 if i should come after j
0 if they are equal
See also:
java.util.Comparator

Implemented in lucene::search::ScoreDocComparators::Relevance, lucene::search::ScoreDocComparators::IndexOrder, lucene::search::ScoreDocComparators::String, lucene::search::ScoreDocComparators::Int32, and lucene::search::ScoreDocComparators::Float.

virtual lucene:: util ::Comparable* lucene::search::ScoreDocComparator::sortValue ( struct ScoreDoc i  )  [pure virtual]

Returns the value used to sort the given document.

The object returned must implement the java.io.Serializable interface. This is used by multisearchers to determine how to collate results from their searchers.

See also:
FieldDoc
Parameters:
i Document
Returns:
Serializable object

Implemented in lucene::search::ScoreDocComparators::Relevance, lucene::search::ScoreDocComparators::IndexOrder, lucene::search::ScoreDocComparators::String, lucene::search::ScoreDocComparators::Int32, and lucene::search::ScoreDocComparators::Float.

virtual int32_t lucene::search::ScoreDocComparator::sortType (  )  [pure virtual]

Returns the type of sort.

Should return SortField.SCORE, SortField.DOC, SortField.STRING, SortField.INTEGER, SortField::FLOAT or SortField.CUSTOM. It is not valid to return SortField.AUTO. This is used by multisearchers to determine how to collate results from their searchers.

Returns:
One of the constants in SortField.
See also:
SortField

Implemented in lucene::search::ScoreDocComparators::Relevance, lucene::search::ScoreDocComparators::IndexOrder, lucene::search::ScoreDocComparators::String, lucene::search::ScoreDocComparators::Int32, and lucene::search::ScoreDocComparators::Float.


Field Documentation

Special comparator for sorting hits according to computed relevance (document score).

Special comparator for sorting hits according to index order (document number).


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

clucene.sourceforge.net