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 ordslonggetValue(int ordinal) Get value by ordinal.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:FacetCutterGet cutter for the leaf.- Specified by:
createLeafCutterin interfaceFacetCutter- Throws:
IOException
-
getLabel
Description copied from interface:OrdToLabelget label of one ord TODO: what do we return when ordinal is not valid? null?- Specified by:
getLabelin 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:OrdToLabelget labels for multiple ords- Specified by:
getLabelsin interfaceOrdToLabel- Throws:
IOException
-