public enum MultiValueMode extends Enum<MultiValueMode >
| Enum Constant and Description |
|---|
AVG
Average of all the values.
|
MAX
Pick the highest value.
|
MIN
Pick the lowest value.
|
SUM
Sum of all the values.
|
| Modifier and Type | Method and Description |
|---|---|
org |
apply(org
|
abstract double |
apply(double a, double b)
Applies the sort mode and returns the result.
|
abstract long |
apply(long a, long b)
Applies the sort mode and returns the result.
|
int |
applyOrd(int ord1, int ord2)
|
static MultiValueMode |
fromString(String
A case insensitive version of
valueOf(String)
|
protected int |
pick(org
|
protected org |
pick(SortedBinaryDocValues
|
protected long |
pick(org
|
protected double |
pick(SortedNumericDoubleValues
|
double |
reduce(double a, int numValues)
Returns the aggregated value based on the sort mode.
|
long |
reduce(long a, int numValues)
Returns the aggregated value based on the sort mode.
|
org |
select(org
Return a
SortedDocValues instance that can be used to sort documents with this mode and the provided values.
|
org |
select(org
Return a
SortedDocValues instance that can be used to sort root documents with this mode, the provided values and filters for root/inner documents.
|
org |
select(SortedBinaryDocValues
Return a
BinaryDocValues instance that can be used to sort documents with this mode and the provided values.
|
org |
select(SortedBinaryDocValues
Return a
BinaryDocValues instance that can be used to sort root documents with this mode, the provided values and filters for root/inner documents.
|
org |
select(org
Return a
NumericDocValues instance that can be used to sort documents with this mode and the provided values.
|
org |
select(org
Return a
NumericDocValues instance that can be used to sort root documents with this mode, the provided values and filters for root/inner documents.
|
NumericDoubleValues |
select(SortedNumericDoubleValues
Return a
NumericDoubleValues instance that can be used to sort documents with this mode and the provided values.
|
NumericDoubleValues |
select(SortedNumericDoubleValues
Return a
NumericDoubleValues instance that can be used to sort root documents with this mode, the provided values and filters for root/inner documents.
|
double |
startDouble()
Returns an initial value for the sort mode that is guaranteed to have no impact if passed to
apply(double, double).
|
long |
startLong()
Returns an initial value for the sort mode that is guaranteed to have no impact if passed to
apply(long, long).
|
static MultiValueMode |
valueOf(String
Returns the enum constant of this type with the specified name.
|
static MultiValueMode |
values()
Returns an array containing the constants of this enum type, in the order they are declared.
|
public static final MultiValueModeSUM
public static final MultiValueModeAVG
public static final MultiValueModeMIN
public static final MultiValueModeMAX
public static MultiValueMode[] values()
for (MultiValueMode c : MultiValueMode.values()) System.out.println(c);
public static MultiValueModevalueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null
public abstract double apply(double a,
double b)
MAX this method is equivalent to
Math.max(double, double) . Note: all implementations are idempotent.
a - an argument
b - another argument
public abstract long apply(long a,
long b)
MAX this method is equivalent to
Math.max(long, long) . Note: all implementations are idempotent.
a - an argument
b - another argument
public int applyOrd(int ord1,
int ord2)public org.apache .lucene .util .BytesRef apply(org .apache .lucene .util .BytesRef a, org .apache .lucene .util .BytesRef b)
public double startDouble()
apply(double, double). This value should be used as the initial value if the sort mode is applied to a non-empty list of values. For instance:
double relevantValue = sortMode.startDouble();
for (int i = 0; i < array.length; i++) {
relevantValue = sortMode.apply(array[i], relevantValue);
}
Note: This method return
0 by default.
public long startLong()
apply(long, long). This value should be used as the initial value if the sort mode is applied to a non-empty list of values. For instance:
long relevantValue = sortMode.startLong();
for (int i = 0; i < array.length; i++) {
relevantValue = sortMode.apply(array[i], relevantValue);
}
Note: This method return
0 by default.
public double reduce(double a,
int numValues)
AVG is used this method divides the given value by the number of values. The default implementation returns the first argument. Note: all implementations are idempotent.
public long reduce(long a,
int numValues)
AVG is used this method divides the given value by the number of values. The default implementation returns the first argument. Note: all implementations are idempotent.
public static MultiValueModefromString(String sortMode)
valueOf(String)
ElasticsearchIllegalArgumentException - if the given string doesn't match a sort mode or is
null.
protected long pick(org.apache .lucene .index .SortedNumericDocValues values, long missingValue)
public org.apache .lucene .index .NumericDocValues select(org .apache .lucene .index .SortedNumericDocValues values, long missingValue)
NumericDocValues instance that can be used to sort documents with this mode and the provided values. When a document has no value,
missingValue is returned.
public org.apache .lucene .index .NumericDocValues select(org .apache .lucene .index .SortedNumericDocValues values, long missingValue, org .apache .lucene .util .FixedBitSet rootDocs, org .apache .lucene .util .FixedBitSet innerDocs, int maxDoc)
NumericDocValues instance that can be used to sort root documents with this mode, the provided values and filters for root/inner documents. For every root document, the values of its inner documents will be aggregated. If none of the inner documents has a value, then
missingValue is returned. NOTE: Calling the returned instance on docs that are not root docs is illegal
protected double pick(SortedNumericDoubleValuesvalues, double missingValue)
public NumericDoubleValuesselect(SortedNumericDoubleValues values, double missingValue)
NumericDoubleValues instance that can be used to sort documents with this mode and the provided values. When a document has no value,
missingValue is returned.
public NumericDoubleValuesselect(SortedNumericDoubleValues values, double missingValue, org .apache .lucene .util .FixedBitSet rootDocs, org .apache .lucene .util .FixedBitSet innerDocs, int maxDoc)
NumericDoubleValues instance that can be used to sort root documents with this mode, the provided values and filters for root/inner documents. For every root document, the values of its inner documents will be aggregated. If none of the inner documents has a value, then
missingValue is returned. NOTE: Calling the returned instance on docs that are not root docs is illegal
protected org.apache .lucene .util .BytesRef pick(SortedBinaryDocValues values, org .apache .lucene .util .BytesRef missingValue)
public org.apache .lucene .index .BinaryDocValues select(SortedBinaryDocValues values, org .apache .lucene .util .BytesRef missingValue)
BinaryDocValues instance that can be used to sort documents with this mode and the provided values. When a document has no value,
missingValue is returned.
public org.apache .lucene .index .BinaryDocValues select(SortedBinaryDocValues values, org .apache .lucene .util .BytesRef missingValue, org .apache .lucene .util .FixedBitSet rootDocs, org .apache .lucene .util .FixedBitSet innerDocs, int maxDoc)
BinaryDocValues instance that can be used to sort root documents with this mode, the provided values and filters for root/inner documents. For every root document, the values of its inner documents will be aggregated. If none of the inner documents has a value, then
missingValue is returned. NOTE: Calling the returned instance on docs that are not root docs is illegal
protected int pick(org.apache .lucene .index .RandomAccessOrds values)
public org.apache .lucene .index .SortedDocValues select(org .apache .lucene .index .RandomAccessOrds values)
SortedDocValues instance that can be used to sort documents with this mode and the provided values.
public org.apache .lucene .index .SortedDocValues select(org .apache .lucene .index .RandomAccessOrds values, org .apache .lucene .util .FixedBitSet rootDocs, org .apache .lucene .util .FixedBitSet innerDocs)
SortedDocValues instance that can be used to sort root documents with this mode, the provided values and filters for root/inner documents. For every root document, the values of its inner documents will be aggregated. NOTE: Calling the returned instance on docs that are not root docs is illegal