Class LongValueFacetCutter

  • All Implemented Interfaces:
    FacetCutter, OrdToLabel

    public final class LongValueFacetCutter
    extends Object
    implements 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 Detail

      • LongValueFacetCutter

        public LongValueFacetCutter​(String field)
        Constructor.
        Parameters:
        field - field name to read long values from.
    • Method Detail

      • getLabel

        public FacetLabel getLabel​(int ordinal)
        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 interface OrdToLabel
      • 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