Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Public Member Functions | Properties | List of all members
Lucene.Net.Search.FieldComparator.StringOrdValComparator Class Reference

Sorts by field's natural String sort order, using ordinals. This is functionally equivalent to FieldComparator.StringValComparator , but it first resolves the string to their relative ordinal positions (using the index returned by FieldCache.GetStringIndex), and does most comparisons using the ordinals. For medium to large results, this comparator will be much faster than FieldComparator.StringValComparator. For very small result sets it may be slower. More...

Inherits Lucene.Net.Search.FieldComparator.

Public Member Functions

 StringOrdValComparator (int numHits, System.String field, int sortPos, bool reversed)
 
override int Compare (int slot1, int slot2)
 Compare hit at slot1 with hit at slot2.
 
override int CompareBottom (int doc)
 Compare the bottom of the queue with doc. This will only invoked after setBottom has been called. This should return the same result as Compare(int,int) } as if bottom were slot1 and the new document were slot 2.
 
override void Copy (int slot, int doc)
 This method is called when a new hit is competitive. You should copy any state associated with this document that will be required for future comparisons, into the specified slot.
 
override void SetNextReader (IndexReader reader, int docBase)
 Set a new Reader. All doc correspond to the current Reader.
 
override void SetBottom (int bottom)
 Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When CompareBottom is called, you should compare against this slot. This will always be called before CompareBottom.
 
string[] GetValues ()
 
- Public Member Functions inherited from Lucene.Net.Search.FieldComparator
virtual void SetScorer (Scorer scorer)
 Sets the Scorer to use in case a document's score is needed.
 

Properties

override IComparable this[int slot] [get]
 
int BottomSlot [get]
 
string Field [get]
 
- Properties inherited from Lucene.Net.Search.FieldComparator
abstract IComparable this[int slot] [get]
 Return the actual value in the slot.
 

Detailed Description

Sorts by field's natural String sort order, using ordinals. This is functionally equivalent to FieldComparator.StringValComparator , but it first resolves the string to their relative ordinal positions (using the index returned by FieldCache.GetStringIndex), and does most comparisons using the ordinals. For medium to large results, this comparator will be much faster than FieldComparator.StringValComparator. For very small result sets it may be slower.

Definition at line 776 of file FieldComparator.cs.

Constructor & Destructor Documentation

Lucene.Net.Search.FieldComparator.StringOrdValComparator.StringOrdValComparator ( int  numHits,
System.String  field,
int  sortPos,
bool  reversed 
)

Definition at line 794 of file FieldComparator.cs.

Member Function Documentation

override int Lucene.Net.Search.FieldComparator.StringOrdValComparator.Compare ( int  slot1,
int  slot2 
)
virtual

Compare hit at slot1 with hit at slot2.

Parameters
slot1first slot to compare
slot2second slot to compare
Returns
any N < 0 if slot2's value is sorted after slot1, any N > 0 if the slot2's value is sorted before slot1 and 0 if they are equal

Implements Lucene.Net.Search.FieldComparator.

Definition at line 804 of file FieldComparator.cs.

override int Lucene.Net.Search.FieldComparator.StringOrdValComparator.CompareBottom ( int  doc)
virtual

Compare the bottom of the queue with doc. This will only invoked after setBottom has been called. This should return the same result as Compare(int,int) } as if bottom were slot1 and the new document were slot 2.

For a search that hits many results, this method will be the hotspot (invoked by far the most frequently).

Parameters
docthat was hit
Returns
any N < 0 if the doc's value is sorted after the bottom entry (not competitive), any N > 0 if the doc's value is sorted before the bottom entry and 0 if they are equal.

Implements Lucene.Net.Search.FieldComparator.

Definition at line 832 of file FieldComparator.cs.

override void Lucene.Net.Search.FieldComparator.StringOrdValComparator.Copy ( int  slot,
int  doc 
)
virtual

This method is called when a new hit is competitive. You should copy any state associated with this document that will be required for future comparisons, into the specified slot.

Parameters
slotwhich slot to copy the hit to
docdocID relative to current reader

Implements Lucene.Net.Search.FieldComparator.

Definition at line 898 of file FieldComparator.cs.

string [] Lucene.Net.Search.FieldComparator.StringOrdValComparator.GetValues ( )

Definition at line 939 of file FieldComparator.cs.

override void Lucene.Net.Search.FieldComparator.StringOrdValComparator.SetBottom ( int  slot)
virtual

Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When CompareBottom is called, you should compare against this slot. This will always be called before CompareBottom.

Parameters
slotthe currently weakest (sorted last) slot in the queue

Implements Lucene.Net.Search.FieldComparator.

Definition at line 921 of file FieldComparator.cs.

override void Lucene.Net.Search.FieldComparator.StringOrdValComparator.SetNextReader ( IndexReader  reader,
int  docBase 
)
virtual

Set a new Reader. All doc correspond to the current Reader.

Parameters
readercurrent reader
docBasedocBase of this reader

<throws> IOException </throws> <throws> IOException </throws>

Implements Lucene.Net.Search.FieldComparator.

Definition at line 907 of file FieldComparator.cs.

Property Documentation

int Lucene.Net.Search.FieldComparator.StringOrdValComparator.BottomSlot
get

Definition at line 945 of file FieldComparator.cs.

string Lucene.Net.Search.FieldComparator.StringOrdValComparator.Field
get

Definition at line 950 of file FieldComparator.cs.

override IComparable Lucene.Net.Search.FieldComparator.StringOrdValComparator.this[int slot]
get

Definition at line 935 of file FieldComparator.cs.


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