Lucene++ - a full-featured, c++ search engine
API Documentation
Go to the documentation of this file.
7 #ifndef FIELDCOMPARATOR_H
8 #define FIELDCOMPARATOR_H
53 virtual int32_t
compare(int32_t slot1, int32_t slot2) = 0;
75 virtual void copy(int32_t slot, int32_t doc) = 0;
90 virtual ComparableValue
value(int32_t slot) = 0;
93 template <
typename TYPE>
112 virtual int32_t
compare(int32_t slot1, int32_t slot2) {
120 virtual void copy(int32_t slot, int32_t doc) {
128 virtual ComparableValue
value(int32_t slot) {
129 return ComparableValue(
values[slot]);
161 virtual void copy(int32_t slot, int32_t doc);
177 virtual int32_t
compare(int32_t slot1, int32_t slot2);
194 virtual int32_t
compare(int32_t slot1, int32_t slot2);
211 virtual int32_t
compare(int32_t slot1, int32_t slot2);
230 virtual int32_t
compare(int32_t slot1, int32_t slot2);
232 virtual void copy(int32_t slot, int32_t doc);
253 virtual int32_t
compare(int32_t slot1, int32_t slot2);
255 virtual void copy(int32_t slot, int32_t doc);
258 virtual ComparableValue
value(int32_t slot);
290 virtual int32_t
compare(int32_t slot1, int32_t slot2);
292 virtual void copy(int32_t slot, int32_t doc);
295 virtual ComparableValue
value(int32_t slot);
321 virtual int32_t
compare(int32_t slot1, int32_t slot2);
323 virtual void copy(int32_t slot, int32_t doc);
326 virtual ComparableValue
value(int32_t slot);
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)
Set a new Reader. All doc correspond to the current Reader.
IntParserPtr parser
Definition: FieldComparator.h:188
StringValComparator(int32_t numHits, const String &field)
Collection< int32_t > order
Definition: FieldComparator.h:280
virtual void copy(int32_t slot, int32_t doc)=0
This method is called when a new hit is competitive. You should copy any state associated with this d...
String bottom
Definition: FieldComparator.h:318
int32_t bottomSlot
Definition: FieldComparator.h:283
DoubleComparator(int32_t numHits, const String &field, const ParserPtr &parser)
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)
Set a new Reader. All doc correspond to the current Reader.
Parses field's values as int (using FieldCache#getInts and sorts by ascending value.
Definition: FieldComparator.h:183
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Collection< String > values
Definition: FieldComparator.h:312
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)
Set a new Reader. All doc correspond to the current Reader.
DocComparator(int32_t numHits)
virtual int32_t compareBottom(int32_t doc)
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
StringComparatorLocale(int32_t numHits, const String &field, const std::locale &locale)
virtual ~StringComparatorLocale()
Utility template class to handle collections that can be safely copied and shared.
Definition: Collection.h:17
String bottomValue
Definition: FieldComparator.h:285
TYPE bottom
Definition: FieldComparator.h:109
NumericComparator(int32_t numHits, const String &field=EmptyString)
Definition: FieldComparator.h:96
int32_t sortPos
Definition: FieldComparator.h:287
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)
Set a new Reader. All doc correspond to the current Reader.
virtual void setBottom(int32_t slot)
Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When compareBottom is called,...
LongComparator(int32_t numHits, const String &field, const ParserPtr &parser)
bool reversed
Definition: FieldComparator.h:286
virtual void setScorer(const ScorerPtr &scorer)
Sets the Scorer to use in case a document's score is needed.
Sorts by field's natural String sort order. All comparisons are done using String....
Definition: FieldComparator.h:307
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)
Set a new Reader. All doc correspond to the current Reader.
LongParserPtr parser
Definition: FieldComparator.h:205
Collection< int32_t > ords
Definition: FieldComparator.h:271
virtual int32_t compareBottom(int32_t doc)
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
Definition: FieldComparator.h:116
virtual ~DoubleComparator()
String bottom
Definition: FieldComparator.h:250
virtual int32_t compare(int32_t slot1, int32_t slot2)=0
Compare hit at slot1 with hit at slot2.
virtual int32_t compareBottom(int32_t doc)
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
IntComparator(int32_t numHits, const String &field, const ParserPtr &parser)
virtual Collection< String > getValues()
Collection< int32_t > readerGen
Definition: FieldComparator.h:276
boost::shared_ptr< Collator > CollatorPtr
Definition: LuceneTypes.h:525
CollatorPtr collator
Definition: FieldComparator.h:249
virtual void copy(int32_t slot, int32_t doc)
This method is called when a new hit is competitive. You should copy any state associated with this d...
Definition: FieldComparator.h:120
A FieldComparator compares hits so as to determine their sort order when collecting the top results w...
Definition: FieldComparator.h:42
virtual void setBottom(int32_t slot)=0
Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When compareBottom is called,...
virtual ~LongComparator()
virtual void setBottom(int32_t slot)
Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When compareBottom is called,...
Collection< String > lookup
Definition: FieldComparator.h:279
int32_t docBase
Definition: FieldComparator.h:154
virtual int32_t compareBottom(int32_t doc)
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
virtual ~FieldComparator()
virtual ComparableValue value(int32_t slot)
Return the actual value in the slot.
Parses field's values as long (using FieldCache#getLongs and sorts by ascending value.
Definition: FieldComparator.h:200
virtual int32_t compareBottom(int32_t doc)
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
Collection< TYPE > values
Definition: FieldComparator.h:106
String field
Definition: FieldComparator.h:317
int32_t currentReaderGen
Definition: FieldComparator.h:278
Definition: AbstractAllTermDocs.h:12
String field
Definition: FieldComparator.h:248
Sorts by field's natural String sort order, using ordinals. This is functionally equivalent to {},...
Definition: FieldComparator.h:266
Base class for all Lucene classes.
Definition: LuceneObject.h:31
boost::shared_ptr< DoubleParser > DoubleParserPtr
Definition: LuceneTypes.h:328
StringOrdValComparator(int32_t numHits, const String &field, int32_t sortPos, bool reversed)
DoubleParserPtr parser
Definition: FieldComparator.h:171
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)=0
Set a new Reader. All doc correspond to the current Reader.
virtual int32_t compare(int32_t slot1, int32_t slot2)
Compare hit at slot1 with hit at slot2.
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)
Set a new Reader. All doc correspond to the current Reader.
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
Collection< String > values
Definition: FieldComparator.h:275
int32_t bottomOrd
Definition: FieldComparator.h:284
boost::shared_ptr< LongParser > LongParserPtr
Definition: LuceneTypes.h:378
virtual int32_t compare(int32_t slot1, int32_t slot2)
Compare hit at slot1 with hit at slot2.
virtual void copy(int32_t slot, int32_t doc)
This method is called when a new hit is competitive. You should copy any state associated with this d...
boost::shared_ptr< IntParser > IntParserPtr
Definition: LuceneTypes.h:376
ByteComparator(int32_t numHits, const String &field, const ParserPtr &parser)
Parses field's values as byte (using FieldCache#getBytes and sorts by ascending value.
Definition: FieldComparator.h:134
virtual int32_t compare(int32_t slot1, int32_t slot2)
Compare hit at slot1 with hit at slot2.
void convert(int32_t slot)
virtual int32_t compare(int32_t slot1, int32_t slot2)
Compare hit at slot1 with hit at slot2.
Definition: FieldComparator.h:112
virtual int32_t compare(int32_t slot1, int32_t slot2)
Compare hit at slot1 with hit at slot2.
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)
Set a new Reader. All doc correspond to the current Reader.
String field
Definition: FieldComparator.h:108
Sorts by a field's value using the Collator for a given Locale.
Definition: FieldComparator.h:238
Sorts by ascending docID.
Definition: FieldComparator.h:149
Sorts by descending relevance. NOTE: if you are sorting only by descending relevance and then seconda...
Definition: FieldComparator.h:219
virtual int32_t compareBottom(int32_t doc)
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)
Set a new Reader. All doc correspond to the current Reader.
virtual ~StringValComparator()
virtual ~StringOrdValComparator()
virtual String getField()
boost::shared_ptr< Scorer > ScorerPtr
Definition: LuceneTypes.h:429
virtual int32_t compare(int32_t slot1, int32_t slot2)
Compare hit at slot1 with hit at slot2.
String field
Definition: FieldComparator.h:281
virtual void copy(int32_t slot, int32_t doc)
This method is called when a new hit is competitive. You should copy any state associated with this d...
ByteParserPtr parser
Definition: FieldComparator.h:139
static this_type newInstance(int32_t size=0)
Definition: Collection.h:33
virtual ~NumericComparator()
Definition: FieldComparator.h:102
int32_t binarySearch(Collection< String > lookup, const String &key, int32_t low, int32_t high)
ScorerPtr scorer
Definition: FieldComparator.h:224
virtual ComparableValue value(int32_t slot)
Return the actual value in the slot.
boost::shared_ptr< ByteParser > ByteParserPtr
Definition: LuceneTypes.h:289
virtual void copy(int32_t slot, int32_t doc)
This method is called when a new hit is competitive. You should copy any state associated with this d...
boost::shared_ptr< Parser > ParserPtr
Definition: LuceneTypes.h:401
virtual ~ByteComparator()
virtual int32_t getBottomSlot()
virtual int32_t compare(int32_t slot1, int32_t slot2)
Compare hit at slot1 with hit at slot2.
virtual void setBottom(int32_t slot)
Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When compareBottom is called,...
virtual void setNextReader(const IndexReaderPtr &reader, int32_t docBase)
Set a new Reader. All doc correspond to the current Reader.
Parses field's values as double (using FieldCache#getDoubles and sorts by ascending value.
Definition: FieldComparator.h:166
virtual ComparableValue value(int32_t slot)
Return the actual value in the slot.
Definition: FieldComparator.h:128
Definition: FieldComparator.h:94
virtual int32_t compareBottom(int32_t doc)
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
Collection< String > currentReaderValues
Definition: FieldComparator.h:316
virtual void setBottom(int32_t slot)
Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When compareBottom is called,...
Definition: FieldComparator.h:124
virtual ComparableValue value(int32_t slot)
Return the actual value in the slot.
virtual int32_t compare(int32_t slot1, int32_t slot2)
Compare hit at slot1 with hit at slot2.
virtual int32_t compareBottom(int32_t doc)
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
virtual int32_t compareBottom(int32_t doc)=0
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
RelevanceComparator(int32_t numHits)
Collection< String > values
Definition: FieldComparator.h:243
virtual void copy(int32_t slot, int32_t doc)
This method is called when a new hit is competitive. You should copy any state associated with this d...
virtual void setScorer(const ScorerPtr &scorer)
Sets the Scorer to use in case a document's score is needed.
virtual int32_t compareBottom(int32_t doc)
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called....
Collection< TYPE > currentReaderValues
Definition: FieldComparator.h:107
Collection< String > currentReaderValues
Definition: FieldComparator.h:247
virtual void copy(int32_t slot, int32_t doc)
This method is called when a new hit is competitive. You should copy any state associated with this d...
virtual ~RelevanceComparator()
virtual ComparableValue value(int32_t slot)=0
Return the actual value in the slot.
clucene.sourceforge.net