Lucene++ - a full-featured, c++ search engine
API Documentation
Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them. More...
#include <SortField.h>
Public Member Functions | |
SortField (const String &field, int32_t type, bool reverse=false) | |
Creates a sort by terms in the given field with the type of term values explicitly given. | |
SortField (const String &field, const ParserPtr &parser, bool reverse=false) | |
Creates a sort, possibly in reverse, by terms in the given field, parsed to numeric values using a custom Parser . | |
SortField (const String &field, const std::locale &locale, bool reverse=false) | |
Creates a sort, possibly in reverse, by terms in the given field sorted according to the given locale. | |
SortField (const String &field, const FieldComparatorSourcePtr &comparator, bool reverse=false) | |
Creates a sort, possibly in reverse, with a custom comparison function. | |
virtual | ~SortField () |
virtual String | getClassName () |
boost::shared_ptr< SortField > | shared_from_this () |
String | getField () |
Returns the name of the field. Could return null if the sort is by SCORE or DOC. | |
int32_t | getType () |
Returns the type of contents in the field. | |
localePtr | getLocale () |
Returns the Locale by which term values are interpreted. | |
ParserPtr | getParser () |
Returns the instance of a FieldCache parser that fits to the given sort type. May return null if no parser was specified. Sorting is using the default parser then. | |
bool | getReverse () |
Returns whether the sort should be reversed. | |
FieldComparatorSourcePtr | getComparatorSource () |
Returns the FieldComparatorSource used for custom sorting. | |
virtual String | toString () |
Returns a string representation of the object. | |
virtual bool | equals (const LuceneObjectPtr &other) |
Returns true if other is equal to this. If a FieldComparatorSource or Parser was provided, it must properly implement equals (unless a singleton is always used). | |
virtual int32_t | hashCode () |
Return hash code for this object. | |
FieldComparatorPtr | getComparator (int32_t numHits, int32_t sortPos) |
Returns the FieldComparator to use for sorting. | |
![]() | |
virtual | ~LuceneObject () |
virtual void | initialize () |
Called directly after instantiation to create objects that depend on this object being fully constructed. | |
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
Return clone of this object. | |
virtual int32_t | compareTo (const LuceneObjectPtr &other) |
Compare two objects. | |
![]() | |
virtual | ~LuceneSync () |
virtual SynchronizePtr | getSync () |
Return this object synchronize lock. | |
virtual LuceneSignalPtr | getSignal () |
Return this object signal. | |
virtual void | lock (int32_t timeout=0) |
Lock this object using an optional timeout. | |
virtual void | unlock () |
Unlock this object. | |
virtual bool | holdsLock () |
Returns true if this object is currently locked by current thread. | |
virtual void | wait (int32_t timeout=0) |
Wait for signal using an optional timeout. | |
virtual void | notifyAll () |
Notify all threads waiting for signal. | |
Static Public Member Functions | |
static String | _getClassName () |
static SortFieldPtr | FIELD_SCORE () |
Represents sorting by document score (relevancy). | |
static SortFieldPtr | FIELD_DOC () |
Represents sorting by document number (index order). | |
Data Fields | |
INTERNAL | : bool reverse |
String | field |
int32_t | type |
localePtr | locale |
ParserPtr | parser |
Static Public Attributes | |
static const int32_t | SCORE |
Sort by document score (relevancy). Sort values are Double and higher values are at the front. | |
static const int32_t | DOC |
Sort by document number (index order). Sort values are Integer and lower values are at the front. | |
static const int32_t | STRING |
Sort using term values as Strings. Sort values are String and lower values are at the front. | |
static const int32_t | INT |
Sort using term values as Integers. Sort values are Integer and lower values are at the front. | |
static const int32_t | FLOAT |
Sort using term values as Floats. Sort values are Float and lower values are at the front. | |
static const int32_t | LONG |
Sort using term values as Longs. Sort values are Long and lower values are at the front. | |
static const int32_t | DOUBLE |
Sort using term values as Doubles. Sort values are Double and lower values are at the front. | |
static const int32_t | SHORT |
Sort using term values as Shorts. Sort values are Short and lower values are at the front. | |
static const int32_t | CUSTOM |
Sort using a custom Comparator. Sort values are any ComparableValue and sorting is done according to natural order. | |
static const int32_t | BYTE |
Sort using term values as Bytes. Sort values are Byte and lower values are at the front. | |
static const int32_t | STRING_VAL |
Sort using term values as Strings, but comparing by value (using String::compare) for all comparisons. This is typically slower than STRING , which uses ordinals to do the sorting. | |
Protected Member Functions | |
void | initFieldType (const String &field, int32_t type) |
Sets field and type, and ensures field is not NULL unless type is SCORE or DOC. | |
![]() | |
LuceneObject () | |
Additional Inherited Members | |
![]() | |
SynchronizePtr | objectLock |
LuceneSignalPtr | objectSignal |
Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.
Lucene::SortField::SortField | ( | const String & | field, |
int32_t | type, | ||
bool | reverse = false |
||
) |
Creates a sort by terms in the given field with the type of term values explicitly given.
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. |
Lucene::SortField::SortField | ( | const String & | field, |
const ParserPtr & | parser, | ||
bool | reverse = false |
||
) |
Creates a sort, possibly in reverse, by terms in the given field, parsed to numeric values using a custom Parser
.
field | Name of field to sort by |
parser | Instance of a Parser , which must subclass one of the existing numeric parsers from FieldCache . Sort type is inferred by testing which numeric parser the parser subclasses. |
reverse | True if natural order should be reversed. |
Lucene::SortField::SortField | ( | const String & | field, |
const std::locale & | locale, | ||
bool | reverse = false |
||
) |
Creates a sort, possibly in reverse, by terms in the given field sorted according to the given locale.
field | Name of field to sort by, cannot be null. |
locale | Locale of values in the field. |
reverse | True if natural order should be reversed. |
Lucene::SortField::SortField | ( | const String & | field, |
const FieldComparatorSourcePtr & | comparator, | ||
bool | reverse = false |
||
) |
Creates a sort, possibly in reverse, with a custom comparison function.
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. |
|
virtual |
|
inlinestatic |
|
virtual |
Returns true if other is equal to this. If a FieldComparatorSource
or Parser
was provided, it must properly implement equals (unless a singleton is always used).
Reimplemented from Lucene::LuceneObject.
|
static |
Represents sorting by document number (index order).
|
static |
Represents sorting by document score (relevancy).
|
inlinevirtual |
FieldComparatorPtr Lucene::SortField::getComparator | ( | int32_t | numHits, |
int32_t | sortPos | ||
) |
Returns the FieldComparator
to use for sorting.
numHits | number of top hits the queue will store |
sortPos | position of this SortField within Sort . The comparator is primary if sortPos == 0, secondary if sortPos == 1, etc. Some comparators can optimize themselves when they are the primary sort. |
FieldComparator
to use when sorting FieldComparatorSourcePtr Lucene::SortField::getComparatorSource | ( | ) |
Returns the FieldComparatorSource
used for custom sorting.
String Lucene::SortField::getField | ( | ) |
Returns the name of the field. Could return null if the sort is by SCORE or DOC.
localePtr Lucene::SortField::getLocale | ( | ) |
Returns the Locale by which term values are interpreted.
ParserPtr Lucene::SortField::getParser | ( | ) |
Returns the instance of a FieldCache
parser that fits to the given sort type. May return null if no parser was specified. Sorting is using the default parser then.
bool Lucene::SortField::getReverse | ( | ) |
Returns whether the sort should be reversed.
int32_t Lucene::SortField::getType | ( | ) |
Returns the type of contents in the field.
|
virtual |
Return hash code for this object.
Reimplemented from Lucene::LuceneObject.
|
protected |
Sets field and type, and ensures field is not NULL unless type is SCORE or DOC.
|
inline |
|
virtual |
Returns a string representation of the object.
Reimplemented from Lucene::LuceneObject.
INTERNAL Lucene::SortField::__pad0__ |
|
static |
|
static |
|
static |
|
static |
String Lucene::SortField::field |
|
static |
|
static |
localePtr Lucene::SortField::locale |
|
static |
ParserPtr Lucene::SortField::parser |
|
static |
|
static |
|
static |
|
static |
int32_t Lucene::SortField::type |