Class CategoryListParams
- java.lang.Object
-
- org.apache.lucene.facet.index.params.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 Summary
Fields Modifier and Type Field Description static Term
DEFAULT_TERM
The default term used to store the facets information.
-
Constructor Summary
Constructors Constructor Description CategoryListParams()
Constructs a default category list parameters object, usingDEFAULT_TERM
.CategoryListParams(Term term)
Constructs a category list parameters object, using the givenTerm
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CategoryListIterator
createCategoryListIterator(IndexReader reader, int partition)
Create the category list iterator for the specified partition.IntEncoder
createEncoder()
Allows to override how categories are encoded and decoded.boolean
equals(Object o)
Equality is defined by the 'term' that defines this category list.Term
getTerm()
ATerm
who's payload holds the category-list.int
hashCode()
Hashcode is similar toequals(Object)
, in that it uses the term that defines this category list to derive the hashcode.
-
-
-
Field Detail
-
DEFAULT_TERM
public static final Term DEFAULT_TERM
The default term used to store the facets information.
-
-
Constructor Detail
-
CategoryListParams
public CategoryListParams()
Constructs a default category list parameters object, usingDEFAULT_TERM
.
-
-
Method Detail
-
createEncoder
public IntEncoder createEncoder()
Allows to override how categories are encoded and decoded. A matchingIntDecoder
is provided by theIntEncoder
.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.
-
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.
-
hashCode
public int hashCode()
Hashcode is similar toequals(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 theTotalFacetCounts
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).
-
createCategoryListIterator
public CategoryListIterator createCategoryListIterator(IndexReader reader, int partition) throws IOException
Create the category list iterator for the specified partition.- Throws:
IOException
-
-