| java.lang.Object org.apache.lucene.search.SortField
SortField | public class SortField implements Serializable(Code) | | 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
author: Tim Jones (Nacimiento Software) since: lucene 1.4 version: $Id: SortField.java 598296 2007-11-26 14:52:01Z mikemccand $ See Also: Sort |
Field Summary | |
final public static int | AUTO Guess type of sort based on field contents. | final public static int | CUSTOM Sort using a custom Comparator. | final public static int | DOC Sort by document number (index order). | final public static int | DOUBLE Sort using term values as encoded Doubles. | final public static SortField | FIELD_DOC Represents sorting by document number (index order). | final public static SortField | FIELD_SCORE Represents sorting by document score (relevancy). | final public static int | FLOAT Sort using term values as encoded Floats. | final public static int | INT Sort using term values as encoded Integers. | final public static int | LONG Sort using term values as encoded Longs. | final public static int | SCORE Sort by document score (relevancy). | final public static int | STRING Sort using term values as Strings. | boolean | reverse |
Constructor Summary | |
public | SortField(String field) Creates a sort by terms in the given field where the type of term value
is determined dynamically (
SortField.AUTO AUTO ). | public | SortField(String field, boolean reverse) Creates a sort, possibly in reverse, by terms in the given field where
the type of term value is determined dynamically (
SortField.AUTO AUTO ). | public | SortField(String field, int type) Creates a sort by terms in the given field with the type of term
values explicitly given.
Parameters: field - Name of field to sort by. | public | SortField(String field, int type, boolean reverse) Creates a sort, possibly in reverse, by terms in the given field with the
type of term values explicitly given.
Parameters: field - Name of field to sort by. | public | SortField(String field, Locale locale) Creates a sort by terms in the given field sorted
according to the given locale. | public | SortField(String field, Locale locale, boolean reverse) Creates a sort, possibly in reverse, by terms in the given field sorted
according to the given locale. | public | SortField(String field, SortComparatorSource comparator) Creates a sort with a custom comparison function. | public | SortField(String field, SortComparatorSource comparator, boolean reverse) Creates a sort, possibly in reverse, with a custom comparison function. |
AUTO | final public static int AUTO(Code) | | Guess type of sort based on field contents. A regular expression is used
to look at the first term indexed for the field and determine if it
represents an integer number, a floating point number, or just arbitrary
string characters.
|
CUSTOM | final public static int CUSTOM(Code) | | Sort using a custom Comparator. Sort values are any Comparable and
sorting is done according to natural order.
|
DOC | final public static int DOC(Code) | | Sort by document number (index order). Sort values are Integer and lower
values are at the front.
|
DOUBLE | final public static int DOUBLE(Code) | | Sort using term values as encoded Doubles. Sort values are Double and
lower values are at the front.
|
FIELD_DOC | final public static SortField FIELD_DOC(Code) | | Represents sorting by document number (index order).
|
FIELD_SCORE | final public static SortField FIELD_SCORE(Code) | | Represents sorting by document score (relevancy).
|
FLOAT | final public static int FLOAT(Code) | | Sort using term values as encoded Floats. Sort values are Float and
lower values are at the front.
|
INT | final public static int INT(Code) | | Sort using term values as encoded Integers. Sort values are Integer and
lower values are at the front.
|
LONG | final public static int LONG(Code) | | Sort using term values as encoded Longs. Sort values are Long and
lower values are at the front.
|
SCORE | final public static int SCORE(Code) | | Sort by document score (relevancy). Sort values are Float and higher
values are at the front.
|
STRING | final public static int STRING(Code) | | Sort using term values as Strings. Sort values are String and lower
values are at the front.
|
SortField | public SortField(String field)(Code) | | Creates a sort by terms in the given field where the type of term value
is determined dynamically (
SortField.AUTO AUTO ).
Parameters: field - Name of field to sort by, cannot be null . |
SortField | public SortField(String field, boolean reverse)(Code) | | Creates a sort, possibly in reverse, by terms in the given field where
the type of term value is determined dynamically (
SortField.AUTO AUTO ).
Parameters: field - Name of field to sort by, cannot be null . Parameters: reverse - True if natural order should be reversed. |
SortField | public SortField(String field, int type)(Code) | | Creates a sort by terms in the given field with the type of term
values explicitly given.
Parameters: field - Name of field to sort by. Can be null iftype is SCORE or DOC. Parameters: type - Type of values in the terms. |
SortField | public SortField(String field, int type, boolean reverse)(Code) | | Creates a sort, possibly in reverse, by terms in the given field with the
type of term values explicitly given.
Parameters: field - Name of field to sort by. Can be null iftype is SCORE or DOC. Parameters: type - Type of values in the terms. Parameters: reverse - True if natural order should be reversed. |
SortField | public SortField(String field, Locale locale)(Code) | | Creates a sort by terms in the given field sorted
according to the given locale.
Parameters: field - Name of field to sort by, cannot be null . Parameters: locale - Locale of values in the field. |
SortField | public SortField(String field, Locale locale, boolean reverse)(Code) | | Creates a sort, possibly in reverse, by terms in the given field sorted
according to the given locale.
Parameters: field - Name of field to sort by, cannot be null . Parameters: locale - Locale of values in the field. |
SortField | public SortField(String field, SortComparatorSource comparator)(Code) | | Creates a sort with a custom comparison function.
Parameters: field - Name of field to sort by; cannot be null . Parameters: comparator - Returns a comparator for sorting hits. |
SortField | public SortField(String field, SortComparatorSource comparator, boolean reverse)(Code) | | Creates a sort, possibly in reverse, with a custom comparison function.
Parameters: field - Name of field to sort by; cannot be null . Parameters: comparator - Returns a comparator for sorting hits. Parameters: reverse - True if natural order should be reversed. |
getField | public String getField()(Code) | | Returns the name of the field. Could return null
if the sort is by SCORE or DOC.
Name of field, possibly null . |
getLocale | public Locale getLocale()(Code) | | Returns the Locale by which term values are interpreted.
May return null if no Locale was specified.
Locale, or null . |
getReverse | public boolean getReverse()(Code) | | Returns whether the sort should be reversed.
True if natural order should be reversed. |
getType | public int getType()(Code) | | Returns the type of contents in the field.
One of the constants SCORE, DOC, AUTO, STRING, INT or FLOAT. |
|
|