Package de.cxp.ocs.elasticsearch.facets
Class FixedIntervalFacetCreator.NumericRange
java.lang.Object
org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range
de.cxp.ocs.elasticsearch.facets.FixedIntervalFacetCreator.NumericRange
- All Implemented Interfaces:
org.elasticsearch.common.io.stream.Writeable
,org.elasticsearch.xcontent.ToXContent
,org.elasticsearch.xcontent.ToXContentObject
- Enclosing class:
FixedIntervalFacetCreator
public static class FixedIntervalFacetCreator.NumericRange
extends org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range
A restricted range to numeric values only.
Note that the upper bound is exclusive, so a range from 1-5 won't contain the records with value 5 and a range from 1-1 will yield no results at all. So to have an "inclusive range" for such values use for example 1.0 - 5.01 and to hide the fact of that range, use an according range label.
Although open ranges are possible at Elasticsearch by setting one of from and to to null, the created filters are invalid since they will contain the text "Infinite" which can't be parsed by OCS. That's why primitives are enforced with this implementation. To achieve open ranges use your a low or high value plus a custom range label.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
org.elasticsearch.common.io.stream.Writeable.Reader<V>, org.elasticsearch.common.io.stream.Writeable.Writer<V>
-
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range
from, FROM_FIELD, fromAsStr, key, KEY_FIELD, originalFrom, originalTo, PARSER, to, TO_FIELD, toAsStr
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorsConstructorDescriptionNumericRange
(double from, double to) NumericRange
(int from, int to) NumericRange
(String rangeLabel, double from, double to) NumericRange
(String rangeLabel, int from, int to) -
Method Summary
Methods inherited from class org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range
equals, getFrom, getFromAsString, getKey, getOriginalFrom, getOriginalTo, getTo, getToAsString, hashCode, matches, toString, toXContent, writeTo
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Constructor Details
-
NumericRange
-
NumericRange
public NumericRange(double from, double to) -
NumericRange
public NumericRange(int from, int to) -
NumericRange
-