Class LongValueFacetCutter
java.lang.Object
org.apache.lucene.sandbox.facet.cutters.LongValueFacetCutter
- All Implemented Interfaces:
FacetCutter
,OrdToLabel
FacetCutter
and OrdToLabel
for distinct long values.
TODO: This class is quite inefficient. Will optimise later.
TODO: add support for other value sources e.g: LongValues
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateLeafCutter
(LeafReaderContext context) Get cutter for the leaf.getLabel
(int ordinal) get label of one ord TODO: what do we return when ordinal is not valid? null?getLabels
(int[] ordinals) get labels for multiple ordslong
getValue
(int ordinal) Get value by ordinal.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.sandbox.facet.cutters.FacetCutter
getChildrenOrds, getOrdinalsToRollup
-
Constructor Details
-
LongValueFacetCutter
Constructor.- Parameters:
field
- field name to read long values from.
-
-
Method Details
-
createLeafCutter
Description copied from interface:FacetCutter
Get cutter for the leaf.- Specified by:
createLeafCutter
in interfaceFacetCutter
- Throws:
IOException
-
getLabel
Description copied from interface:OrdToLabel
get label of one ord TODO: what do we return when ordinal is not valid? null?- Specified by:
getLabel
in interfaceOrdToLabel
-
getValue
public long getValue(int ordinal) Get value by ordinal. Should only be called after collection phase.TODO: we need it to tie break sort by value. Alternatively we can sort by label (then we don't need this method), but we would have to convert FacetLabel to "long" to have the same order... Overall, it is probably not important to tie break by value, and we can tie break by ord same as for other facets; but for now we don't want to change results order just in case.
- Parameters:
ordinal
- facet ordinal.- Returns:
- long value
-
getLabels
Description copied from interface:OrdToLabel
get labels for multiple ords- Specified by:
getLabels
in interfaceOrdToLabel
- Throws:
IOException
-