Class CategoryListParams

  • All Implemented Interfaces:
    Serializable

    public class CategoryListParams
    extends Object
    implements Serializable
    Contains parameters for a category list *
    See Also:
    Serialized Form
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Field Detail

      • DEFAULT_TERM

        public static final org.apache.lucene.index.Term DEFAULT_TERM
        The default term used to store the facets information.
    • Constructor Detail

      • CategoryListParams

        public CategoryListParams()
        Constructs a default category list parameters object, using DEFAULT_TERM.
      • CategoryListParams

        public CategoryListParams​(org.apache.lucene.index.Term term)
        Constructs a category list parameters object, using the given Term.
        Parameters:
        term - who's payload hold the category-list.
    • Method Detail

      • getTerm

        public final org.apache.lucene.index.Term getTerm()
        A Term who's payload holds the category-list.
      • createEncoder

        public IntEncoder createEncoder()
        Allows to override how categories are encoded and decoded. A matching IntDecoder is provided by the IntEncoder.

        Default implementation creates a new Sorting(Unique(DGap)) encoder. Uniqueness in this regard means when the same category appears twice in a document, only one appearance would be encoded. This has effect on facet counting results.

        Some possible considerations when overriding may be:

        • an application "knows" that all categories are unique. So no need to pass through the unique filter.
        • Another application might wish to count multiple occurrences of the same category, or, use a faster encoding which will consume more space.
        In any event when changing this value make sure you know what you are doing, and test the results - e.g. counts, if the application is about counting facets.
      • equals

        public boolean equals​(Object o)
        Equality is defined by the 'term' that defines this category list. Sub-classes should override this method if a more complex calculation is needed to ensure equality.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Hashcode is similar to equals(Object), in that it uses the term that defines this category list to derive the hashcode. Subclasses need to ensure that equality/hashcode is correctly defined, or there could be side-effects in the TotalFacetCounts caching mechanism (as the filename for a Total Facet Counts array cache is dependent on the hashCode, so it should consistently return the same hash for identity).
        Overrides:
        hashCode in class Object
      • createCategoryListIterator

        public CategoryListIterator createCategoryListIterator​(org.apache.lucene.index.IndexReader reader,
                                                               int partition)
                                                        throws IOException
        Create the category list iterator for the specified partition.
        Throws:
        IOException