C# Class Lucene.Net.Search.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

Show file Open project: apache/lucenenet Class Usage Examples

Public Properties

Property Type Description
FIELD_DOC SortField
FIELD_SCORE SortField
STRING_FIRST object
STRING_LAST object
missingValue object

Public Methods

Method Description
Equals ( object o ) : bool

Returns true if o is equal to this. If a FieldComparatorSource or {@link FieldCache.Parser} was provided, it must properly implement equals (unless a singleton is always used).

GetComparator ( int numHits, int sortPos ) : FieldComparator

Returns the FieldComparator to use for sorting. @lucene.experimental

GetHashCode ( ) : int

Returns true if o is equal to this. If a FieldComparatorSource or {@link FieldCache.Parser} was provided, it must properly implement hashCode (unless a singleton is always used).

NeedsScores ( ) : bool

Whether the relevance score is needed to sort documents.

Rewrite ( IndexSearcher searcher ) : SortField

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 SortField.Type#REWRITEABLE

SortField ( string field, Lucene.Net.Search.FieldCache parser ) : System

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

SortField ( string field, FieldCache parser, bool reverse ) : System

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

SortField ( string field, FieldComparatorSource comparator ) : System

Creates a sort with a custom comparison function.

SortField ( string field, FieldComparatorSource comparator, bool reverse ) : System

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

SortField ( string field, Type_e type ) : System

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

SortField ( string field, Type_e type, bool reverse ) : System

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

ToString ( ) : string

Private Methods

Method Description
InitFieldType ( string field, Type_e type ) : void

Method Details

Equals() public method

Returns true if o is equal to this. If a FieldComparatorSource or {@link FieldCache.Parser} was provided, it must properly implement equals (unless a singleton is always used).
public Equals ( object o ) : bool
o object
return bool

GetComparator() public method

Returns the FieldComparator to use for sorting. @lucene.experimental
public GetComparator ( int numHits, int sortPos ) : FieldComparator
numHits int number of top hits the queue will store
sortPos int position of this SortField within {@link /// Sort}. The comparator is primary if sortPos==0, /// secondary if sortPos==1, etc. Some comparators can /// optimize themselves when they are the primary sort.
return FieldComparator

GetHashCode() public method

Returns true if o is equal to this. If a FieldComparatorSource or {@link FieldCache.Parser} was provided, it must properly implement hashCode (unless a singleton is always used).
public GetHashCode ( ) : int
return int

NeedsScores() public method

Whether the relevance score is needed to sort documents.
public NeedsScores ( ) : bool
return bool

Rewrite() public method

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 SortField.Type#REWRITEABLE
Can be thrown by the rewriting /// @lucene.experimental
public Rewrite ( IndexSearcher searcher ) : SortField
searcher IndexSearcher IndexSearcher to use during rewriting
return SortField

SortField() public method

Creates a sort by terms in the given field, parsed to numeric values using a custom IFieldCache.Parser.
if the parser fails to /// subclass an existing numeric parser, or field is null
public SortField ( string field, Lucene.Net.Search.FieldCache parser ) : System
field string Name of field to sort by. Must not be null.
parser Lucene.Net.Search.FieldCache Instance of a , /// which must subclass one of the existing numeric /// parsers from . Sort type is inferred /// by testing which numeric parser the parser subclasses.
return System

SortField() public method

Creates a sort, possibly in reverse, by terms in the given field, parsed to numeric values using a custom IFieldCache.Parser.
if the parser fails to /// subclass an existing numeric parser, or field is null
public SortField ( string field, FieldCache parser, bool reverse ) : System
field string Name of field to sort by. Must not be null.
parser FieldCache Instance of a , /// which must subclass one of the existing numeric /// parsers from . Sort type is inferred /// by testing which numeric parser the parser subclasses.
reverse bool True if natural order should be reversed.
return System

SortField() public method

Creates a sort with a custom comparison function.
public SortField ( string field, FieldComparatorSource comparator ) : System
field string Name of field to sort by; cannot be null.
comparator FieldComparatorSource Returns a comparator for sorting hits.
return System

SortField() public method

Creates a sort, possibly in reverse, with a custom comparison function.
public SortField ( string field, FieldComparatorSource comparator, bool reverse ) : System
field string Name of field to sort by; cannot be null.
comparator FieldComparatorSource Returns a comparator for sorting hits.
reverse bool True if natural order should be reversed.
return System

SortField() public method

Creates a sort by terms in the given field with the type of term values explicitly given.
public SortField ( string field, Type_e type ) : System
field string Name of field to sort by. Can be null if /// type is SCORE or DOC.
type Type_e Type of values in the terms.
return System

SortField() public method

Creates a sort, possibly in reverse, by terms in the given field with the type of term values explicitly given.
public SortField ( string field, Type_e type, bool reverse ) : System
field string Name of field to sort by. Can be null if /// type is SCORE or DOC.
type Type_e Type of values in the terms.
reverse bool True if natural order should be reversed.
return System

ToString() public method

public ToString ( ) : string
return string

Property Details

FIELD_DOC public static property

Represents sorting by document number (index order).
public static SortField,Lucene.Net.Search FIELD_DOC
return SortField

FIELD_SCORE public static property

Represents sorting by document score (relevance).
public static SortField,Lucene.Net.Search FIELD_SCORE
return SortField

STRING_FIRST public static property

Pass this to #setMissingValue to have missing string values sort first.
public static object STRING_FIRST
return object

STRING_LAST public static property

Pass this to #setMissingValue to have missing string values sort last.
public static object STRING_LAST
return object

missingValue public property

public object missingValue
return object