Class SortedSetSortField
SortField for Lucene.Net.Index.SortedSetDocValues.
A Lucene.Net.Index.SortedSetDocValues contains multiple values for a field, so sorting with this technique "selects" a value as the representative sort value for the document. By default, the minimum value in the set is selected as the sort value, but this can be customized. Selectors other than the default do have some limitations (see below) to ensure that all selections happen in constant-time for performance. Like sorting by string, this also supports sorting missing values as first or last, via SetMissingValue(object). Limitations:Inherited Members
Namespace: Lucene.Net.Sandbox.Queries
Assembly: Lucene.Net.Sandbox.dll
Syntax
public class SortedSetSortField : SortField
Constructors
SortedSetSortField(string, bool)
Creates a sort, possibly in reverse, by the minimum value in the set for the document.
Declaration
public SortedSetSortField(string field, bool reverse)
Parameters
Type | Name | Description |
---|---|---|
string | field | Name of field to sort by. Must not be null. |
bool | reverse | True if natural order should be reversed. |
SortedSetSortField(string, bool, Selector)
Creates a sort, possibly in reverse, specifying how the sort value from the document's set is selected.
Declaration
public SortedSetSortField(string field, bool reverse, Selector selector)
Parameters
Type | Name | Description |
---|---|---|
string | field | Name of field to sort by. Must not be null. |
bool | reverse | True if natural order should be reversed. |
Selector | selector | custom selector for choosing the sort value from the set. NOTE: selectors other than MIN require optional codec support. |
Properties
Selector
Returns the selector in use for this sort
Declaration
public Selector Selector { get; }
Property Value
Type | Description |
---|---|
Selector |
Methods
Equals(object)
Returns true
if o
is equal to this. If a
Lucene.Net.Search.FieldComparerSource or
Lucene.Net.Search.FieldCache.IParser was provided, it must properly
implement equals (unless a singleton is always used).
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
GetComparer(int, int)
Returns the Lucene.Net.Search.FieldComparer to use for sorting.
Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
public override FieldComparer GetComparer(int numHits, int sortPos)
Parameters
Type | Name | Description |
---|---|---|
int | numHits | Number of top hits the queue will store |
int | sortPos | Position of this Lucene.Net.Search.SortField within Lucene.Net.Search.Sort. The comparer is primary if sortPos==0, secondary if sortPos==1, etc. Some comparers can optimize themselves when they are the primary sort. |
Returns
Type | Description |
---|---|
FieldComparer | Lucene.Net.Search.FieldComparer to use when sorting |
Overrides
GetHashCode()
Returns a hash code value for this object. If a Lucene.Net.Search.FieldComparerSource or Lucene.Net.Search.FieldCache.IParser was provided, it must properly implement GetHashCode() (unless a singleton is always used).
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
SetMissingValue(object)
Set how missing values (the empty set) are sorted.
Note that this must be Lucene.Net.Search.SortField.STRING_FIRST or Lucene.Net.Search.SortField.STRING_LAST.Declaration
public override void SetMissingValue(object value)
Parameters
Type | Name | Description |
---|---|---|
object | value |
Overrides
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |