public class SortField extends Object implements Serializable
Created: Feb 11, 2004 1:25:29 PM
Sort
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
AUTO
Guess type of sort based on field contents.
|
static int |
CUSTOM
Sort using a custom Comparator.
|
static int |
DOC
Sort by document number (index order).
|
static SortField |
FIELD_DOC
Represents sorting by document number (index order).
|
static SortField |
FIELD_SCORE
Represents sorting by document score (relevancy).
|
static int |
FLOAT
Sort using term values as encoded Floats.
|
static int |
INT
Sort using term values as encoded Integers.
|
static int |
SCORE
Sort by document score (relevancy).
|
static int |
STRING
Sort using term values as Strings.
|
Constructor and Description |
---|
SortField(String field)
Creates a sort by terms in the given field where the type of term value
is determined dynamically (
AUTO ). |
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 (
AUTO ). |
SortField(String field,
int type)
Creates a sort by terms in the given field with the type of term
values explicitly given.
|
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.
|
SortField(String field,
Locale locale)
Creates a sort by terms in the given field sorted
according to the given locale.
|
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.
|
SortField(String field,
SortComparatorSource comparator)
Creates a sort with a custom comparison function.
|
SortField(String field,
SortComparatorSource comparator,
boolean reverse)
Creates a sort, possibly in reverse, with a custom comparison function.
|
Modifier and Type | Method and Description |
---|---|
SortComparatorSource |
getFactory() |
String |
getField()
Returns the name of the field.
|
Locale |
getLocale()
Returns the Locale by which term values are interpreted.
|
boolean |
getReverse()
Returns whether the sort should be reversed.
|
int |
getType()
Returns the type of contents in the field.
|
String |
toString() |
public static final int SCORE
public static final int DOC
public static final int AUTO
public static final int STRING
public static final int INT
public static final int FLOAT
public static final int CUSTOM
public static final SortField FIELD_SCORE
public SortField(String field)
AUTO
).field
- Name of field to sort by, cannot be null
.public SortField(String field, boolean reverse)
AUTO
).field
- Name of field to sort by, cannot be null
.reverse
- True if natural order should be reversed.public SortField(String field, int type)
field
- Name of field to sort by. Can be null
if
type
is SCORE or DOC.type
- Type of values in the terms.public SortField(String field, int type, boolean reverse)
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.public SortField(String field, Locale locale)
field
- Name of field to sort by, cannot be null
.locale
- Locale of values in the field.public SortField(String field, Locale locale, boolean reverse)
field
- Name of field to sort by, cannot be null
.locale
- Locale of values in the field.public SortField(String field, SortComparatorSource comparator)
field
- Name of field to sort by; cannot be null
.comparator
- Returns a comparator for sorting hits.public SortField(String field, SortComparatorSource comparator, boolean reverse)
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.public String getField()
null
if the sort is by SCORE or DOC.null
.public int getType()
public Locale getLocale()
null
if no Locale was specified.null
.public boolean getReverse()
public SortComparatorSource getFactory()