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


lucene::search::SortField Class Reference

Stores information about how to sort documents by terms in an individual field. More...

#include <Sort.h>


Public Member Functions

virtual ~SortField ()
 LUCENE_STATIC_CONSTANT (int32_t, DOCSCORE=0)
 Sort by document score (relevancy).
 LUCENE_STATIC_CONSTANT (int32_t, DOC=1)
 Sort by document number (index order).
 LUCENE_STATIC_CONSTANT (int32_t, AUTO=2)
 Guess type of sort based on field contents.
 LUCENE_STATIC_CONSTANT (int32_t, STRING=3)
 Sort using term values as Strings.
 LUCENE_STATIC_CONSTANT (int32_t, INT=4)
 Sort using term values as encoded Integers.
 LUCENE_STATIC_CONSTANT (int32_t, FLOAT=5)
 Sort using term values as encoded Floats.
 LUCENE_STATIC_CONSTANT (int32_t, CUSTOM=9)
 Sort using a custom Comparator.
 SortField (const TCHAR *field)
 Creates a sort by terms in the given field where the type of term value is determined dynamically (AUTO).
 SortField (const TCHAR *field, int32_t type, bool reverse)
 Creates a sort, possibly in reverse, by terms in the given field with the type of term values explicitly given.
 SortField (const TCHAR *field, SortComparatorSource *comparator, bool reverse=false)
 Creates a sort, possibly in reverse, with a custom comparison function.
const TCHAR * getField () const
 Returns the name of the field.
SortFieldclone () const
int32_t getType () const
 Returns the type of contents in the field.
bool getReverse () const
 Returns the Locale by which term values are interpreted.
SortComparatorSourcegetFactory () const
TCHAR * toString () const

Static Public Attributes

static SortFieldFIELD_SCORE
 Represents sorting by document score (relevancy).
static SortFieldFIELD_DOC
 Represents sorting by document number (index order).

Protected Member Functions

 SortField (const SortField &clone)


Detailed Description

Stores information about how to sort documents by terms in an individual field.

Fields must be indexed in order to sort by them.


Constructor & Destructor Documentation

lucene::search::SortField::SortField ( const SortField clone  )  [protected]

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

lucene::search::SortField::SortField ( const TCHAR *  field  ) 

Creates a sort by terms in the given field where the type of term value is determined dynamically (AUTO).

Parameters:
field Name of field to sort by, cannot be null.

lucene::search::SortField::SortField ( const TCHAR *  field,
int32_t  type,
bool  reverse 
)

Creates a sort, possibly in reverse, by terms in the given field with the type of term values explicitly given.

Parameters:
field Name of field to sort by. Can be null if type is SCORE or DOC.
type Type of values in the terms.
reverse True if natural order should be reversed (default=false).

lucene::search::SortField::SortField ( const TCHAR *  field,
SortComparatorSource comparator,
bool  reverse = false 
)

Creates a sort, possibly in reverse, with a custom comparison function.

Parameters:
field Name of field to sort by; cannot be null.
comparator Returns a comparator for sorting hits.
reverse True if natural order should be reversed (default=false).


Member Function Documentation

lucene::search::SortField::LUCENE_STATIC_CONSTANT ( int32_t  ,
DOCSCORE  = 0 
)

Sort by document score (relevancy).

Sort values are Float and higher values are at the front. PORTING: this is the same as SCORE in java, it had to be renamed because SCORE is a system macro on some platforms (AIX).

lucene::search::SortField::LUCENE_STATIC_CONSTANT ( int32_t  ,
DOC  = 1 
)

Sort by document number (index order).

Sort values are Integer and lower values are at the front.

lucene::search::SortField::LUCENE_STATIC_CONSTANT ( int32_t  ,
AUTO  = 2 
)

Guess type of sort based on field contents.

A regular expression is used to look at the first term indexed for the field and determine if it represents an integer number, a floating point number, or just arbitrary string characters.

lucene::search::SortField::LUCENE_STATIC_CONSTANT ( int32_t  ,
STRING  = 3 
)

Sort using term values as Strings.

Sort values are String and lower values are at the front.

lucene::search::SortField::LUCENE_STATIC_CONSTANT ( int32_t  ,
INT  = 4 
)

Sort using term values as encoded Integers.

Sort values are Integer and lower values are at the front.

lucene::search::SortField::LUCENE_STATIC_CONSTANT ( int32_t  ,
FLOAT  = 5 
)

Sort using term values as encoded Floats.

Sort values are Float and lower values are at the front.

lucene::search::SortField::LUCENE_STATIC_CONSTANT ( int32_t  ,
CUSTOM  = 9 
)

Sort using a custom Comparator.

Sort values are any Comparable and sorting is done according to natural order.

const TCHAR* lucene::search::SortField::getField (  )  const [inline]

Returns the name of the field.

Could return null if the sort is by SCORE or DOC.

Returns:
Name of field, possibly null.

SortField* lucene::search::SortField::clone (  )  const

int32_t lucene::search::SortField::getType (  )  const [inline]

Returns the type of contents in the field.

Returns:
One of the constants SCORE, DOC, AUTO, STRING, INT or FLOAT.

bool lucene::search::SortField::getReverse (  )  const [inline]

Returns the Locale by which term values are interpreted.

May return null if no Locale was specified.

Returns:
Locale, or null. Returns whether the sort should be reversed.

True if natural order should be reversed.

SortComparatorSource* lucene::search::SortField::getFactory (  )  const [inline]

TCHAR* lucene::search::SortField::toString (  )  const


Field Documentation

Represents sorting by document score (relevancy).

Represents sorting by document number (index order).


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

clucene.sourceforge.net