Package com.yahoo.search.result
Class FieldComparator
java.lang.Object
com.yahoo.search.result.ChainableComparator
com.yahoo.search.result.FieldComparator
- All Implemented Interfaces:
Comparator<Hit>
Comparator used for ordering hits using the field values and a sorting specification.
Note: This comparator imposes orderings that are inconsistent with equals.
- Author:
- Steinar Knutsen
-
Constructor Summary
ConstructorDescriptionFieldComparator
(Sorting sorting) Creates a field comparator using a sort order and having no chained comparatorFieldComparator
(Sorting sorting, Comparator<Hit> secondaryComparator) Creates a field comparator using a sort order with a chained comparator -
Method Summary
Modifier and TypeMethodDescriptionint
Compares hits based on a sorting specification and values stored in hit fields.0static FieldComparator
Creates a comparator given a sorting, or returns null if the given sorting is nulltoString()
Methods inherited from class com.yahoo.search.result.ChainableComparator
getSecondaryComparator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
FieldComparator
Creates a field comparator using a sort order and having no chained comparator -
FieldComparator
Creates a field comparator using a sort order with a chained comparator
-
-
Method Details
-
create
Creates a comparator given a sorting, or returns null if the given sorting is null -
compare
Compares hits based on a sorting specification and values stored in hit fields.0When one of the hits has the requested property and the other has not, the hit containing the property precedes the one that does not.
There is no locale based sorting here, as the backend does not do that either.
- Specified by:
compare
in interfaceComparator<Hit>
- Overrides:
compare
in classChainableComparator
- Returns:
- -1, 0, 1 if first should be sorted before, equal to or after second
-
getField
-
toString
-