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
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public class SortField : object
Constructors
| Improve this Doc View SourceSortField(String, FieldCache.IParser)
Creates a sort by terms in the given field, parsed
to numeric values using a custom Field
Declaration
public SortField(string field, FieldCache.IParser parser)
Parameters
Type | Name | Description |
---|---|---|
System. |
field | Name of field to sort by. Must not be |
Field |
parser | Instance of a Field |
SortField(String, FieldCache.IParser, Boolean)
Creates a sort, possibly in reverse, by terms in the given field, parsed
to numeric values using a custom Field
Declaration
public SortField(string field, FieldCache.IParser parser, bool reverse)
Parameters
Type | Name | Description |
---|---|---|
System. |
field | Name of field to sort by. Must not be |
Field |
parser | Instance of a Field |
System. |
reverse |
|
SortField(String, FieldComparerSource)
Creates a sort with a custom comparison function.
Declaration
public SortField(string field, FieldComparerSource comparer)
Parameters
Type | Name | Description |
---|---|---|
System. |
field | Name of field to sort by; cannot be |
Field |
comparer | Returns a comparer for sorting hits. |
SortField(String, FieldComparerSource, Boolean)
Creates a sort, possibly in reverse, with a custom comparison function.
Declaration
public SortField(string field, FieldComparerSource comparer, bool reverse)
Parameters
Type | Name | Description |
---|---|---|
System. |
field | Name of field to sort by; cannot be |
Field |
comparer | Returns a comparer for sorting hits. |
System. |
reverse |
|
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 |
---|---|---|
System. |
field | Name of field to sort by. Can be |
Sort |
type | Type of values in the terms. |
SortField(String, SortFieldType, Boolean)
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 |
---|---|---|
System. |
field | Name of field to sort by. Can be |
Sort |
type | Type of values in the terms. |
System. |
reverse |
|
Fields
| Improve this Doc View SourceFIELD_DOC
Represents sorting by document number (index order).
Declaration
public static readonly SortField FIELD_DOC
Field Value
Type | Description |
---|---|
Sort |
FIELD_SCORE
Represents sorting by document score (relevance).
Declaration
public static readonly SortField FIELD_SCORE
Field Value
Type | Description |
---|---|
Sort |
m_missingValue
Declaration
protected object m_missingValue
Field Value
Type | Description |
---|---|
System. |
STRING_FIRST
Pass this to Missing
Declaration
public static readonly object STRING_FIRST
Field Value
Type | Description |
---|---|
System. |
STRING_LAST
Pass this to Missing
Declaration
public static readonly object STRING_LAST
Field Value
Type | Description |
---|---|
System. |
Properties
| Improve this Doc View SourceBytesComparer
Declaration
public virtual IComparer<BytesRef> BytesComparer { get; set; }
Property Value
Type | Description |
---|---|
IComparer<Bytes |
ComparerSource
Returns the Field
Declaration
public virtual FieldComparerSource ComparerSource { get; }
Property Value
Type | Description |
---|---|
Field |
Field
Declaration
public virtual string Field { get; }
Property Value
Type | Description |
---|---|
System. |
Name of field, possibly |
IsReverse
Returns whether the sort should be reversed.
Declaration
public virtual bool IsReverse { get; }
Property Value
Type | Description |
---|---|
System. |
|
MissingValue
Declaration
public virtual object MissingValue { get; set; }
Property Value
Type | Description |
---|---|
System. |
NeedsScores
Whether the relevance score is needed to sort documents.
Declaration
public virtual bool NeedsScores { get; }
Property Value
Type | Description |
---|---|
System. |
Parser
Returns the instance of a IFieldnull
if no parser was specified. Sorting is using the default parser then.
Declaration
public virtual FieldCache.IParser Parser { get; }
Property Value
Type | Description |
---|---|
Field |
An instance of a IField |
Type
Returns the type of contents in the field.
Declaration
public virtual SortFieldType Type { get; }
Property Value
Methods
| Improve this Doc View SourceEquals(Object)
Returns true
if o
is equal to this. If a
Field
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
System. |
o |
Returns
Type | Description |
---|---|
System. |
GetComparer(Int32, Int32)
Returns the Field
Declaration
public virtual FieldComparer GetComparer(int numHits, int sortPos)
Parameters
Type | Name | Description |
---|---|---|
System. |
numHits | Number of top hits the queue will store |
System. |
sortPos | Position of this Sort |
Returns
Type | Description |
---|---|
Field |
Field |
GetHashCode()
Returns a hash code value for this object. If a
Field
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System. |
Rewrite(IndexSearcher)
Rewrites this Sort
Declaration
public virtual SortField Rewrite(IndexSearcher searcher)
Parameters
Type | Name | Description |
---|---|---|
Index |
searcher | Index |
Returns
| Improve this Doc View SourceToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System. |