Fork me on GitHub
  • API

    Show / Hide Table of Contents

    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:
    • Fields containing MaxValue or more unique values are unsupported.
    • Selectors other than the default MIN require optional codec support. However several codecs provided by Lucene, including the current default codec, support this.
    Inheritance
    object
    SortField
    SortedSetSortField
    Inherited Members
    SortField.FIELD_SCORE
    SortField.FIELD_DOC
    SortField.MissingValue
    SortField.m_missingValue
    SortField.STRING_FIRST
    SortField.STRING_LAST
    SortField.SetMissingValue(sbyte)
    SortField.SetMissingValue(byte)
    SortField.SetMissingValue(short)
    SortField.SetMissingValue(int)
    SortField.SetMissingValue(long)
    SortField.SetMissingValue(double)
    SortField.SetMissingValue(float)
    SortField.Field
    SortField.Type
    SortField.Parser
    SortField.IsReverse
    SortField.ComparerSource
    SortField.BytesComparer
    SortField.Rewrite(IndexSearcher)
    SortField.NeedsScores
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    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
    SortField.Equals(object)

    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
    SortField.GetComparer(int, int)

    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
    Lucene.Net.Search.SortField.GetHashCode()

    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
    SortField.SetMissingValue(object)

    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.

    Overrides
    Lucene.Net.Search.SortField.ToString()
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.