Class BytesRefFieldComparatorSource
- java.lang.Object
-
- org.apache.lucene.search.FieldComparatorSource
-
- org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource
-
- org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource
-
public class BytesRefFieldComparatorSource extends IndexFieldData.XFieldComparatorSource
Comparator source for string/binary values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource
IndexFieldData.XFieldComparatorSource.Nested
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource
missingValue, nested, sortMode
-
-
Constructor Summary
Constructors Constructor Description BytesRefFieldComparatorSource(IndexFieldData<?> indexFieldData, Object missingValue, MultiValueMode sortMode, IndexFieldData.XFieldComparatorSource.Nested nested)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SortedBinaryDocValuesgetValues(LeafReaderContext context)ObjectmissingValue(boolean reversed)Return a missing value that is understandable bySortField.setMissingValue(Object).FieldComparator<?>newComparator(String fieldname, int numHits, int sortPos, boolean reversed)Creates a comparator for the field in the given index.SortField.TypereducedType()protected voidsetScorer(Scorable scorer)-
Methods inherited from class org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource
missingObject, nested, sortMissingFirst, sortMissingLast, sortMode
-
-
-
-
Constructor Detail
-
BytesRefFieldComparatorSource
public BytesRefFieldComparatorSource(IndexFieldData<?> indexFieldData, Object missingValue, MultiValueMode sortMode, IndexFieldData.XFieldComparatorSource.Nested nested)
-
-
Method Detail
-
reducedType
public SortField.Type reducedType()
- Specified by:
reducedTypein classIndexFieldData.XFieldComparatorSource
-
missingValue
public Object missingValue(boolean reversed)
Description copied from class:IndexFieldData.XFieldComparatorSourceReturn a missing value that is understandable bySortField.setMissingValue(Object). Most implementations return null because they already replace the value at the fielddata level. However this can't work in case of strings since there is no such thing as a string which compares greater than any other string, so in that case we need to returnSortField.STRING_FIRSTorSortField.STRING_LASTso that the coordinating node knows how to deal with null values.- Overrides:
missingValuein classIndexFieldData.XFieldComparatorSource
-
getValues
protected SortedBinaryDocValues getValues(LeafReaderContext context) throws IOException
- Throws:
IOException
-
setScorer
protected void setScorer(Scorable scorer)
-
newComparator
public FieldComparator<?> newComparator(String fieldname, int numHits, int sortPos, boolean reversed)
Description copied from class:FieldComparatorSourceCreates a comparator for the field in the given index.- Specified by:
newComparatorin classFieldComparatorSource- Parameters:
fieldname- Name of the field to create comparator for.- Returns:
- FieldComparator.
-
-