Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class SortField

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Inheritance
    object
    SortField
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public class SortField

    Constructors

    SortField(string, IParser)

    Creates a sort by terms in the given field, parsed to numeric values using a custom FieldCache.IParser.

    Declaration
    public SortField(string field, FieldCache.IParser parser)
    Parameters
    Type Name Description
    string field

    Name of field to sort by. Must not be null.

    FieldCache.IParser parser

    Instance of a FieldCache.IParser, which must subclass one of the existing numeric parsers from IFieldCache. Sort type is inferred by testing which numeric parser the parser subclasses.

    Exceptions
    Type Condition
    ArgumentException

    if the parser fails to subclass an existing numeric parser, or field is null

    See Also
    Sort

    SortField(string, IParser, bool)

    Creates a sort, possibly in reverse, by terms in the given field, parsed to numeric values using a custom FieldCache.IParser.

    Declaration
    public SortField(string field, FieldCache.IParser parser, bool reverse)
    Parameters
    Type Name Description
    string field

    Name of field to sort by. Must not be null.

    FieldCache.IParser parser

    Instance of a FieldCache.IParser, which must subclass one of the existing numeric parsers from IFieldCache. Sort type is inferred by testing which numeric parser the parser subclasses.

    bool reverse

    True if natural order should be reversed.

    Exceptions
    Type Condition
    ArgumentException

    if the parser fails to subclass an existing numeric parser, or field is null

    See Also
    Sort

    SortField(string, FieldComparerSource)

    Creates a sort with a custom comparison function.

    Declaration
    public SortField(string field, FieldComparerSource comparer)
    Parameters
    Type Name Description
    string field

    Name of field to sort by; cannot be null.

    FieldComparerSource comparer

    Returns a comparer for sorting hits.

    See Also
    Sort

    SortField(string, FieldComparerSource, bool)

    Creates a sort, possibly in reverse, with a custom comparison function.

    Declaration
    public SortField(string field, FieldComparerSource comparer, bool reverse)
    Parameters
    Type Name Description
    string field

    Name of field to sort by; cannot be null.

    FieldComparerSource comparer

    Returns a comparer for sorting hits.

    bool reverse

    True if natural order should be reversed.

    See Also
    Sort

    SortField(string, SortFieldType)

    Creates a sort by terms in the given field with the type of term values explicitly given.

    Declaration
    public SortField(string field, SortFieldType type)
    Parameters
    Type Name Description
    string field

    Name of field to sort by. Can be null if type is SCORE or DOC.

    SortFieldType type

    Type of values in the terms.

    See Also
    Sort

    SortField(string, SortFieldType, bool)

    Creates a sort, possibly in reverse, by terms in the given field with the type of term values explicitly given.

    Declaration
    public SortField(string field, SortFieldType type, bool reverse)
    Parameters
    Type Name Description
    string field

    Name of field to sort by. Can be null if type is SCORE or DOC.

    SortFieldType type

    Type of values in the terms.

    bool reverse

    True if natural order should be reversed.

    See Also
    Sort

    Fields

    FIELD_DOC

    Represents sorting by document number (index order).

    Declaration
    public static readonly SortField FIELD_DOC
    Field Value
    Type Description
    SortField
    See Also
    Sort

    FIELD_SCORE

    Represents sorting by document score (relevance).

    Declaration
    public static readonly SortField FIELD_SCORE
    Field Value
    Type Description
    SortField
    See Also
    Sort

    STRING_FIRST

    Pass this to MissingValue to have missing string values sort first.

    Declaration
    public static readonly object STRING_FIRST
    Field Value
    Type Description
    object
    See Also
    Sort

    STRING_LAST

    Pass this to MissingValue to have missing string values sort last.

    Declaration
    public static readonly object STRING_LAST
    Field Value
    Type Description
    object
    See Also
    Sort

    m_missingValue

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    protected object m_missingValue
    Field Value
    Type Description
    object
    See Also
    Sort

    Properties

    BytesComparer

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    public virtual IComparer<BytesRef> BytesComparer { get; set; }
    Property Value
    Type Description
    IComparer<BytesRef>
    See Also
    Sort

    ComparerSource

    Returns the FieldComparerSource used for custom sorting.

    Declaration
    public virtual FieldComparerSource ComparerSource { get; }
    Property Value
    Type Description
    FieldComparerSource
    See Also
    Sort

    Field

    Returns the name of the field. Could return null if the sort is by SCORE or DOC.

    Declaration
    public virtual string Field { get; }
    Property Value
    Type Description
    string

    Name of field, possibly null.

    See Also
    Sort

    IsReverse

    Returns whether the sort should be reversed.

    Declaration
    public virtual bool IsReverse { get; }
    Property Value
    Type Description
    bool

    True if natural order should be reversed.

    See Also
    Sort

    MissingValue

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    public object MissingValue { get; }
    Property Value
    Type Description
    object
    See Also
    Sort

    NeedsScores

    Whether the relevance score is needed to sort documents.

    Declaration
    public virtual bool NeedsScores { get; }
    Property Value
    Type Description
    bool
    See Also
    Sort

    Parser

    Returns the instance of a IFieldCache parser that fits to the given sort type. May return null if no parser was specified. Sorting is using the default parser then.

    Declaration
    public virtual FieldCache.IParser Parser { get; }
    Property Value
    Type Description
    FieldCache.IParser

    An instance of a IFieldCache parser, or null.

    See Also
    Sort

    Type

    Returns the type of contents in the field.

    Declaration
    public virtual SortFieldType Type { get; }
    Property Value
    Type Description
    SortFieldType

    One of SCORE, DOC, STRING, INT32 or SINGLE.

    See Also
    Sort

    Methods

    Equals(object)

    Returns true if o is equal to this. If a FieldComparerSource or FieldCache.IParser was provided, it must properly implement equals (unless a singleton is always used).

    Declaration
    public override bool Equals(object o)
    Parameters
    Type Name Description
    object o
    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)
    See Also
    Sort

    GetComparer(int, int)

    Returns the FieldComparer to use for sorting.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Declaration
    public virtual 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 SortField within 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

    FieldComparer to use when sorting

    See Also
    Sort

    GetHashCode()

    Returns a hash code value for this object. If a FieldComparerSource or 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
    object.GetHashCode()
    See Also
    Sort

    Rewrite(IndexSearcher)

    Rewrites this SortField, returning a new SortField if a change is made. Subclasses should override this define their rewriting behavior when this SortField is of type REWRITEABLE.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Declaration
    public virtual SortField Rewrite(IndexSearcher searcher)
    Parameters
    Type Name Description
    IndexSearcher searcher

    IndexSearcher to use during rewriting

    Returns
    Type Description
    SortField

    New rewritten SortField, or this if nothing has changed.

    Exceptions
    Type Condition
    IOException

    Can be thrown by the rewriting

    See Also
    Sort

    SetMissingValue(byte)

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    [Obsolete]
    public void SetMissingValue(byte value)
    Parameters
    Type Name Description
    byte value
    See Also
    Sort

    SetMissingValue(double)

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    public void SetMissingValue(double value)
    Parameters
    Type Name Description
    double value
    See Also
    Sort

    SetMissingValue(short)

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    [Obsolete]
    public void SetMissingValue(short value)
    Parameters
    Type Name Description
    short value
    See Also
    Sort

    SetMissingValue(int)

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    public void SetMissingValue(int value)
    Parameters
    Type Name Description
    int value
    See Also
    Sort

    SetMissingValue(long)

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    public void SetMissingValue(long value)
    Parameters
    Type Name Description
    long value
    See Also
    Sort

    SetMissingValue(object)

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    public virtual void SetMissingValue(object value)
    Parameters
    Type Name Description
    object value
    See Also
    Sort

    SetMissingValue(sbyte)

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    [CLSCompliant(false)]
    [Obsolete]
    public void SetMissingValue(sbyte value)
    Parameters
    Type Name Description
    sbyte value
    See Also
    Sort

    SetMissingValue(float)

    Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

    Created: Feb 11, 2004 1:25:29 PM

    @since lucene 1.4
    Declaration
    public void SetMissingValue(float value)
    Parameters
    Type Name Description
    float value
    See Also
    Sort

    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
    object.ToString()
    See Also
    Sort

    See Also

    Sort
    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.