All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.antidot.api.search.IntervalFacetValueHelper Maven / Gradle / Ivy

The newest version!
package net.antidot.api.search;

import java.util.ArrayList;
import java.util.List;

import net.antidot.protobuf.facets.FacetsProto.Interval;

/** Represents one value of interval facet.
 * 

* You can get access to main data such as: *

    *
  • key used to filter on specific facet value,
  • *
  • label for better integration than simple key,
  • *
  • count of documents defining the facet value,
  • *
  • sub-facet values for hierarchical facets.
  • *
*/ public class IntervalFacetValueHelper implements FacetValueHelperInterface { private Interval interval; /** Constructs new value helper. * You should never call this constructor directly. * Instances of this class are constructed when necessary while querying {@link FacetHelper#getValues()}. * @param interval [in] Google protobuf used to initialize this instance. */ public IntervalFacetValueHelper(Interval interval) { this.interval = interval; } /* (non-Javadoc) * @see net.antidot.api.search.FacetValueHelperInterface#getKey() */ public String getKey() { return interval.getKey(); } /* (non-Javadoc) * @see net.antidot.api.search.FacetValueHelperInterface#getLabel() */ public String getLabel() { if (interval.getLabelsCount() > 0) { return interval.getLabels(0).getLabel(); } else { return getKey(); } } /* (non-Javadoc) * @see net.antidot.api.search.FacetValueHelperInterface#getCount() */ public long getCount() { return interval.getItems(); } /** List sub-values of this facet value. * @return empty list of sub-values. */ public List getValues() { return new ArrayList(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy