Class NumericFacetEntryBuilder
java.lang.Object
de.cxp.ocs.elasticsearch.facets.helper.NumericFacetEntryBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionlong
int
boolean
boolean
-
Constructor Summary
ConstructorsConstructorDescriptionNumericFacetEntryBuilder
(NumberResultFilter facetFilter) NumericFacetEntryBuilder
(Number lowerBound, Number upperBound) -
Method Summary
Modifier and TypeMethodDescriptionString[]
getLabel
(FacetConfiguration.FacetConfig facetConfig) Sophisticated interval label that considers nullable lower or upper bound value or if this interval is the first or last one.
-
Field Details
-
isFirstEntry
public boolean isFirstEntry -
isLastEntry
public boolean isLastEntry -
lowerBound
-
upperBound
-
currentDocumentCount
public long currentDocumentCount -
currentVariantCount
public int currentVariantCount -
label
-
-
Constructor Details
-
NumericFacetEntryBuilder
-
NumericFacetEntryBuilder
-
-
Method Details
-
getFilterValues
-
getLabel
Sophisticated interval label that considers nullable lower or upper bound value or if this interval is the first or last one.
The way the label is created is also configurable via meta-data set at the facet config. First the optional rounding of the values:
- lowerBoundAdjustValue: // a positive or negative decimal value that is added to each lower bound value prior to formatting
- upperBoundAdjustValue: // a positive or negative decimal value that is added to each upper bound value prior to formatting
- round: (down|true|up) // if set, the numbers will be rounded accordingly: "true" for natural rounding, "down" for always floor rounding and "up" for always ceil rounding. Using 'showInclusiveRanges:true' and 'round:floor' will practically round down the upper bounds to the next lower integral number
- decimals: 0-2 // if set to 0, the numbers will be rounded to a whole number. Defaults to 2
Also there is some config to define the binding strings around the values inside the label.
- noLowerBoundPrefix: string that should be used as prefix for the first interval when practically no lower bound value is defined
- noLowerBoundSuffix: same as noLowerBoundPrefix but used as suffix
- intervalSeparator: the line separator between lower and upper bound for intermediate intervals
- noUpperBoundPrefix: string that should be used as prefix for the last interval when there is no upper bound value defined
- noUpperBoundSuffix: same as noUpperBoundPrefix but as suffix
- unit: a string that is appended to every value
- unitAsPrefix: set to 'true' to use the unit as a prefix instead, e.g. for £25
- Parameters:
facetConfig
- config of the related facet- Returns:
- a nicely formatted label
-