Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them. More...
Public Member Functions | |
SortField (System.String field, int type) | |
Creates a sort by terms in the given field with the type of term values explicitly given. | |
SortField (System.String field, int type, bool reverse) | |
Creates a sort, possibly in reverse, by terms in the given field with the type of term values explicitly given. | |
SortField (System.String field, Lucene.Net.Search.Parser parser) | |
Creates a sort by terms in the given field, parsed to numeric values using a custom Search.Parser. | |
SortField (System.String field, Lucene.Net.Search.Parser parser, bool reverse) | |
Creates a sort, possibly in reverse, by terms in the given field, parsed to numeric values using a custom Search.Parser. | |
SortField (System.String field, System.Globalization.CultureInfo locale) | |
Creates a sort by terms in the given field sorted according to the given locale. | |
SortField (System.String field, System.Globalization.CultureInfo locale, bool reverse) | |
Creates a sort, possibly in reverse, by terms in the given field sorted according to the given locale. | |
SortField (System.String field, FieldComparatorSource comparator) | |
Creates a sort with a custom comparison function. | |
SortField (System.String field, FieldComparatorSource comparator, bool reverse) | |
Creates a sort, possibly in reverse, with a custom comparison function. | |
override System.String | ToString () |
override bool | Equals (System.Object o) |
Returns true if o is equal to this. If a FieldComparatorSource or Search.Parser was provided, it must properly implement equals (unless a singleton is always used). | |
override int | GetHashCode () |
Returns true if o is equal to this. If a FieldComparatorSource (deprecated) or Search.Parser was provided, it must properly implement hashCode (unless a singleton is always used). | |
virtual FieldComparator | GetComparator (int numHits, int sortPos) |
Returns the FieldComparator to use for sorting. | |
Public Attributes | |
const int | SCORE = 0 |
Sort by document score (relevancy). Sort values are Float and higher values are at the front. | |
const int | DOC = 1 |
Sort by document number (index order). Sort values are Integer and lower values are at the front. | |
const int | STRING = 3 |
Sort using term values as Strings. Sort values are String and lower values are at the front. | |
const int | INT = 4 |
Sort using term values as encoded Integers. Sort values are Integer and lower values are at the front. | |
const int | FLOAT = 5 |
Sort using term values as encoded Floats. Sort values are Float and lower values are at the front. | |
const int | LONG = 6 |
Sort using term values as encoded Longs. Sort values are Long and lower values are at the front. | |
const int | DOUBLE = 7 |
Sort using term values as encoded Doubles. Sort values are Double and lower values are at the front. | |
const int | SHORT = 8 |
Sort using term values as encoded Shorts. Sort values are Short and lower values are at the front. | |
const int | CUSTOM = 9 |
Sort using a custom Comparator. Sort values are any Comparable and sorting is done according to natural order. | |
const int | BYTE = 10 |
Sort using term values as encoded Bytes. Sort values are Byte and lower values are at the front. | |
const int | STRING_VAL = 11 |
Sort using term values as Strings, but comparing by value (using String.compareTo) for all comparisons. This is typically slower than STRING, which uses ordinals to do the sorting. | |
Static Public Attributes | |
static readonly SortField | FIELD_SCORE = new SortField(null, SCORE) |
Represents sorting by document score (relevancy). | |
static readonly SortField | FIELD_DOC = new SortField(null, DOC) |
Represents sorting by document number (index order). | |
Properties | |
virtual string | Field [get] |
Returns the name of the field. Could return null if the sort is by SCORE or DOC. | |
virtual int | Type [get] |
Returns the type of contents in the field. | |
virtual CultureInfo | Locale [get] |
Returns the Locale by which term values are interpreted. May return null if no Locale was specified. | |
virtual Parser | Parser [get] |
Returns the instance of a FieldCache parser that fits to the given sort type. May return null if no parser was specified. Sorting is using the default parser then. | |
virtual bool | Reverse [get] |
Returns whether the sort should be reversed. | |
virtual FieldComparatorSource | ComparatorSource [get] |
Returns the FieldComparatorSource used for custom sorting | |
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
Definition at line 38 of file SortField.cs.
Lucene.Net.Search.SortField.SortField | ( | System.String | field, |
int | type | ||
) |
Creates a sort by terms in the given field with the type of term values explicitly given.
field | Name of field to sort by. Can be null if type is SCORE or DOC. |
type | Type of values in the terms. |
Definition at line 126 of file SortField.cs.
Lucene.Net.Search.SortField.SortField | ( | System.String | field, |
int | type, | ||
bool | reverse | ||
) |
Creates a sort, possibly in reverse, by terms in the given field with the type of term values explicitly given.
field | Name of field to sort by. Can be null if type is SCORE or DOC. |
type | Type of values in the terms. |
reverse | True if natural order should be reversed. |
Definition at line 141 of file SortField.cs.
Lucene.Net.Search.SortField.SortField | ( | System.String | field, |
Lucene.Net.Search.Parser | parser | ||
) |
Creates a sort by terms in the given field, parsed to numeric values using a custom Search.Parser.
field | Name of field to sort by. Must not be null. |
parser | Instance of a Search.Parser, which must subclass one of the existing numeric parsers from FieldCache. Sort type is inferred by testing which numeric parser the parser subclasses. |
<throws> IllegalArgumentException if the parser fails to </throws>
subclass an existing numeric parser, or field is null
Definition at line 160 of file SortField.cs.
Lucene.Net.Search.SortField.SortField | ( | System.String | field, |
Lucene.Net.Search.Parser | parser, | ||
bool | reverse | ||
) |
Creates a sort, possibly in reverse, by terms in the given field, parsed to numeric values using a custom Search.Parser.
field | Name of field to sort by. Must not be null. |
parser | Instance of a Search.Parser, which must subclass one of the existing numeric parsers from FieldCache. Sort type is inferred by testing which numeric parser the parser subclasses. |
reverse | True if natural order should be reversed. |
<throws> IllegalArgumentException if the parser fails to </throws>
subclass an existing numeric parser, or field is null
Definition at line 179 of file SortField.cs.
Lucene.Net.Search.SortField.SortField | ( | System.String | field, |
System.Globalization.CultureInfo | locale | ||
) |
Creates a sort by terms in the given field sorted according to the given locale.
field | Name of field to sort by, cannot be null . |
locale | Locale of values in the field. |
Definition at line 209 of file SortField.cs.
Lucene.Net.Search.SortField.SortField | ( | System.String | field, |
System.Globalization.CultureInfo | locale, | ||
bool | reverse | ||
) |
Creates a sort, possibly in reverse, by terms in the given field sorted according to the given locale.
field | Name of field to sort by, cannot be null . |
locale | Locale of values in the field. |
Definition at line 222 of file SortField.cs.
Lucene.Net.Search.SortField.SortField | ( | System.String | field, |
FieldComparatorSource | comparator | ||
) |
Creates a sort with a custom comparison function.
field | Name of field to sort by; cannot be null . |
comparator | Returns a comparator for sorting hits. |
Definition at line 234 of file SortField.cs.
Lucene.Net.Search.SortField.SortField | ( | System.String | field, |
FieldComparatorSource | comparator, | ||
bool | reverse | ||
) |
Creates a sort, possibly in reverse, with a custom comparison function.
field | Name of field to sort by; cannot be null . |
comparator | Returns a comparator for sorting hits. |
reverse | True if natural order should be reversed. |
Definition at line 247 of file SortField.cs.
override bool Lucene.Net.Search.SortField.Equals | ( | System.Object | o | ) |
Returns true if o
is equal to this. If a FieldComparatorSource or Search.Parser was provided, it must properly implement equals (unless a singleton is always used).
Definition at line 391 of file SortField.cs.
|
virtual |
Returns the FieldComparator to use for sorting.
NOTE: This API is experimental and might change in incompatible ways in the next release.
numHits | number of top hits the queue will store |
sortPos | position of this SortField within Sort . The comparator is primary if sortPos==0, secondary if sortPos==1, etc. Some comparators can optimize themselves when they are the primary sort. |
Definition at line 459 of file SortField.cs.
override int Lucene.Net.Search.SortField.GetHashCode | ( | ) |
Returns true if o
is equal to this. If a FieldComparatorSource (deprecated) or Search.Parser was provided, it must properly implement hashCode (unless a singleton is always used).
Definition at line 413 of file SortField.cs.
override System.String Lucene.Net.Search.SortField.ToString | ( | ) |
Definition at line 320 of file SortField.cs.
const int Lucene.Net.Search.SortField.BYTE = 10 |
Sort using term values as encoded Bytes. Sort values are Byte and lower values are at the front.
Definition at line 90 of file SortField.cs.
const int Lucene.Net.Search.SortField.CUSTOM = 9 |
Sort using a custom Comparator. Sort values are any Comparable and sorting is done according to natural order.
Definition at line 85 of file SortField.cs.
const int Lucene.Net.Search.SortField.DOC = 1 |
Sort by document number (index order). Sort values are Integer and lower values are at the front.
Definition at line 48 of file SortField.cs.
const int Lucene.Net.Search.SortField.DOUBLE = 7 |
Sort using term values as encoded Doubles. Sort values are Double and lower values are at the front.
Definition at line 75 of file SortField.cs.
Represents sorting by document number (index order).
Definition at line 107 of file SortField.cs.
Represents sorting by document score (relevancy).
Definition at line 104 of file SortField.cs.
const int Lucene.Net.Search.SortField.FLOAT = 5 |
Sort using term values as encoded Floats. Sort values are Float and lower values are at the front.
Definition at line 65 of file SortField.cs.
const int Lucene.Net.Search.SortField.INT = 4 |
Sort using term values as encoded Integers. Sort values are Integer and lower values are at the front.
Definition at line 60 of file SortField.cs.
const int Lucene.Net.Search.SortField.LONG = 6 |
Sort using term values as encoded Longs. Sort values are Long and lower values are at the front.
Definition at line 70 of file SortField.cs.
const int Lucene.Net.Search.SortField.SCORE = 0 |
Sort by document score (relevancy). Sort values are Float and higher values are at the front.
Definition at line 43 of file SortField.cs.
const int Lucene.Net.Search.SortField.SHORT = 8 |
Sort using term values as encoded Shorts. Sort values are Short and lower values are at the front.
Definition at line 80 of file SortField.cs.
const int Lucene.Net.Search.SortField.STRING = 3 |
Sort using term values as Strings. Sort values are String and lower values are at the front.
Definition at line 55 of file SortField.cs.
const int Lucene.Net.Search.SortField.STRING_VAL = 11 |
Sort using term values as Strings, but comparing by value (using String.compareTo) for all comparisons. This is typically slower than STRING, which uses ordinals to do the sorting.
Definition at line 97 of file SortField.cs.
|
get |
Returns the FieldComparatorSource used for custom sorting
Definition at line 316 of file SortField.cs.
|
get |
Returns the name of the field. Could return null
if the sort is by SCORE or DOC.
Name of field, possibly <c>null</c>.
Definition at line 275 of file SortField.cs.
|
get |
Returns the Locale by which term values are interpreted. May return null
if no Locale was specified.
Locale, or <c>null</c>.
Definition at line 291 of file SortField.cs.
|
get |
Returns the instance of a FieldCache parser that fits to the given sort type. May return null
if no parser was specified. Sorting is using the default parser then.
An instance of a <see cref="FieldCache" /> parser, or <c>null</c>.
Definition at line 300 of file SortField.cs.
|
get |
Returns whether the sort should be reversed.
True if natural order should be reversed.
Definition at line 307 of file SortField.cs.
|
get |
Returns the type of contents in the field.
One of the constants SCORE, DOC, STRING, INT or FLOAT.
Definition at line 282 of file SortField.cs.