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, java.lang.Object missingValue, MultiValueMode sortMode, IndexFieldData.XFieldComparatorSource.Nested nested) -
Method Summary
Modifier and Type Method Description protected SortedBinaryDocValuesgetValues(org.apache.lucene.index.LeafReaderContext context)java.lang.ObjectmissingValue(boolean reversed)Return a missing value that is understandable bySortField.setMissingValue(Object).BucketedSortnewBucketedSort(BigArrays bigArrays, SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra)Create a BucketedSort which is useful for sorting inside of aggregations.org.apache.lucene.search.FieldComparator<?>newComparator(java.lang.String fieldname, int numHits, int sortPos, boolean reversed)org.apache.lucene.search.SortField.TypereducedType()protected voidsetScorer(org.apache.lucene.search.Scorable scorer)Methods inherited from class org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource
missingObject, nested, sortMissingFirst, sortMissingLast, sortMode
-
Constructor Details
-
BytesRefFieldComparatorSource
public BytesRefFieldComparatorSource(IndexFieldData<?> indexFieldData, java.lang.Object missingValue, MultiValueMode sortMode, IndexFieldData.XFieldComparatorSource.Nested nested)
-
-
Method Details
-
reducedType
public org.apache.lucene.search.SortField.Type reducedType()- Specified by:
reducedTypein classIndexFieldData.XFieldComparatorSource
-
missingValue
public java.lang.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(org.apache.lucene.index.LeafReaderContext context) throws java.io.IOException- Throws:
java.io.IOException
-
setScorer
protected void setScorer(org.apache.lucene.search.Scorable scorer) -
newComparator
public org.apache.lucene.search.FieldComparator<?> newComparator(java.lang.String fieldname, int numHits, int sortPos, boolean reversed)- Specified by:
newComparatorin classorg.apache.lucene.search.FieldComparatorSource
-
newBucketedSort
public BucketedSort newBucketedSort(BigArrays bigArrays, SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra)Description copied from class:IndexFieldData.XFieldComparatorSourceCreate a BucketedSort which is useful for sorting inside of aggregations.- Specified by:
newBucketedSortin classIndexFieldData.XFieldComparatorSource
-