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.4Inherited Members
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 |
| 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 |
See Also
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 |
| 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 |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | if the parser fails to
subclass an existing numeric parser, or field is |
See Also
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 |
| FieldComparerSource | comparer | Returns a comparer for sorting hits. |
See Also
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 |
| FieldComparerSource | comparer | Returns a comparer for sorting hits. |
| bool | reverse |
|
See Also
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 |
| SortFieldType | type | Type of values in the terms. |
See Also
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 |
| SortFieldType | type | Type of values in the terms. |
| bool | reverse |
|
See Also
Fields
FIELD_DOC
Represents sorting by document number (index order).
Declaration
public static readonly SortField FIELD_DOC
Field Value
| Type | Description |
|---|---|
| SortField |
See Also
FIELD_SCORE
Represents sorting by document score (relevance).
Declaration
public static readonly SortField FIELD_SCORE
Field Value
| Type | Description |
|---|---|
| SortField |
See Also
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
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
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.4Declaration
protected object m_missingValue
Field Value
| Type | Description |
|---|---|
| object |
See Also
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.4Declaration
public virtual IComparer<BytesRef> BytesComparer { get; set; }
Property Value
| Type | Description |
|---|---|
| IComparer<BytesRef> |
See Also
ComparerSource
Returns the FieldComparerSource used for custom sorting.
Declaration
public virtual FieldComparerSource ComparerSource { get; }
Property Value
| Type | Description |
|---|---|
| FieldComparerSource |
See Also
Field
Declaration
public virtual string Field { get; }
Property Value
| Type | Description |
|---|---|
| string | Name of field, possibly |
See Also
IsReverse
Returns whether the sort should be reversed.
Declaration
public virtual bool IsReverse { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
See Also
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.4Declaration
public object MissingValue { get; }
Property Value
| Type | Description |
|---|---|
| object |
See Also
NeedsScores
Whether the relevance score is needed to sort documents.
Declaration
public virtual bool NeedsScores { get; }
Property Value
| Type | Description |
|---|---|
| bool |
See Also
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 |
See Also
Type
Returns the type of contents in the field.
Declaration
public virtual SortFieldType Type { get; }
Property Value
| Type | Description |
|---|---|
| SortFieldType |
See Also
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
See Also
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
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
See Also
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 |
Exceptions
| Type | Condition |
|---|---|
| IOException | Can be thrown by the rewriting |
See Also
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.4Declaration
[Obsolete]
public void SetMissingValue(byte value)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | value |
See Also
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.4Declaration
public void SetMissingValue(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value |
See Also
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.4Declaration
[Obsolete]
public void SetMissingValue(short value)
Parameters
| Type | Name | Description |
|---|---|---|
| short | value |
See Also
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.4Declaration
public void SetMissingValue(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value |
See Also
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.4Declaration
public void SetMissingValue(long value)
Parameters
| Type | Name | Description |
|---|---|---|
| long | value |
See Also
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.4Declaration
public virtual void SetMissingValue(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value |
See Also
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.4Declaration
[CLSCompliant(false)]
[Obsolete]
public void SetMissingValue(sbyte value)
Parameters
| Type | Name | Description |
|---|---|---|
| sbyte | value |
See Also
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.4Declaration
public void SetMissingValue(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value |
See Also
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. |