Class FieldComparer
Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public abstract class FieldComparer
Properties
| Improve this Doc View SourceItem[Int32]
Return the actual value in the slot. LUCENENET NOTE: This was value(int) in Lucene.
Declaration
public abstract IComparable this[int slot] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | slot | The value |
Property Value
Type | Description |
---|---|
System.IComparable | Value in this slot |
Methods
| Improve this Doc View SourceCompare(Int32, Int32)
Compare hit at slot1
with hit at slot2
.
Declaration
public abstract int Compare(int slot1, int slot2)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | slot1 | first slot to compare |
System.Int32 | slot2 | second slot to compare |
Returns
Type | Description |
---|---|
System.Int32 | any N < 0 if |
CompareBottom(Int32)
Compare the bottom of the queue with this doc. This will only invoked after setBottom has been called. This should return the same result as Compare(Int32, Int32) 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).
Declaration
public abstract int CompareBottom(int doc)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | doc | Doc that was hit |
Returns
Type | Description |
---|---|
System.Int32 | 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. |
CompareTop(Int32)
Compare the top value with this doc. This will only invoked after SetTopValue(Object) has been called. This should return the same result as Compare(Int32, Int32) as if topValue were slot1 and the new document were slot 2. This is only called for searches that use SearchAfter (deep paging).
Declaration
public abstract int CompareTop(int doc)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | doc | Doc that was hit |
Returns
Type | Description |
---|---|
System.Int32 | 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. |
CompareValues(Object, Object)
Declaration
public abstract int CompareValues(object first, object second)
Parameters
Type | Name | Description |
---|---|---|
System.Object | first | |
System.Object | second |
Returns
Type | Description |
---|---|
System.Int32 |
Copy(Int32, Int32)
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.
Declaration
public abstract void Copy(int slot, int doc)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | slot | Which slot to copy the hit to |
System.Int32 | doc | DocID relative to current reader |
SetBottom(Int32)
Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When CompareBottom(Int32) is called, you should compare against this slot. This will always be called before CompareBottom(Int32).
Declaration
public abstract void SetBottom(int slot)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | slot | The currently weakest (sorted last) slot in the queue |
SetNextReader(AtomicReaderContext)
Set a new AtomicReaderContext. All subsequent docIDs are relative to the current reader (you must add docBase if you need to map it to a top-level docID).
Declaration
public abstract FieldComparer SetNextReader(AtomicReaderContext context)
Parameters
Type | Name | Description |
---|---|---|
AtomicReaderContext | context | Current reader context |
Returns
Type | Description |
---|---|
FieldComparer | The comparer to use for this segment; most comparers can just return "this" to reuse the same comparer across segments |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | if there is a low-level IO error |
SetScorer(Scorer)
Sets the Scorer to use in case a document's score is needed.
Declaration
public virtual void SetScorer(Scorer scorer)
Parameters
Type | Name | Description |
---|---|---|
Scorer | scorer | Scorer instance that you should use to obtain the current hit's score, if necessary. |
SetTopValue(Object)
Record the top value, for future calls to CompareTop(Int32). This is only called for searches that use SearchAfter (deep paging), and is called before any calls to SetNextReader(AtomicReaderContext).
Declaration
public abstract void SetTopValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |