public interface CategoryEnhancement
CategoryEnhancement
will correspond to a CategoryProperty
.
A category enhancement can contribute to the index in two possible ways:
getCategoryTokenBytes(CategoryAttribute)
. This data will be read
during search using extractCategoryTokenData(byte[], int, int)
.CategoryListTokenizer
through
getCategoryListTokenizer(TokenStream, EnhancementsIndexingParams, TaxonomyWriter)
. The CategoryListTokenizer
should add a single token which includes
all the enhancement relevant data from the categories. The category list
token's text is defined by getCategoryListTermText()
.Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Category enhancements must override
Object.equals(Object) , as it is
used in
EnhancementsPayloadIterator.getCategoryData(CategoryEnhancement) . |
Object |
extractCategoryTokenData(byte[] buffer,
int offset,
int length)
Get the data of this enhancement from a category token payload.
|
boolean |
generatesCategoryList()
Declarative method to indicate whether this enhancement generates separate
category list.
|
String |
getCategoryListTermText()
Returns the text of this enhancement's category list term.
|
CategoryListTokenizer |
getCategoryListTokenizer(TokenStream tokenizer,
EnhancementsIndexingParams indexingParams,
TaxonomyWriter taxonomyWriter)
Get the
CategoryListTokenizer which generates the category list for
this enhancement. |
byte[] |
getCategoryTokenBytes(CategoryAttribute categoryAttribute)
Get the bytes to be added to the category token payload for this
enhancement.
|
Class<? extends CategoryProperty> |
getRetainableProperty()
Get a
CategoryProperty class to be retained when creating
CategoryParentsStream . |
byte[] getCategoryTokenBytes(CategoryAttribute categoryAttribute)
NOTE: The returned array is copied, it is recommended to allocate a new one each time.
The bytes generated by this method are the input of
extractCategoryTokenData(byte[], int, int)
.
categoryAttribute
- The attribute of the category.Object extractCategoryTokenData(byte[] buffer, int offset, int length)
The input bytes for this method are generated in
getCategoryTokenBytes(CategoryAttribute)
.
buffer
- The payload buffer.offset
- The offset of this enhancement's data in the buffer.length
- The length of this enhancement's data (bytes).boolean generatesCategoryList()
true
if generates category list, else false
.String getCategoryListTermText()
CategoryListTokenizer getCategoryListTokenizer(TokenStream tokenizer, EnhancementsIndexingParams indexingParams, TaxonomyWriter taxonomyWriter)
CategoryListTokenizer
which generates the category list for
this enhancement. If generatesCategoryList()
returns false
this method will not be called.tokenizer
- The input stream containing categories.indexingParams
- The indexing params to use.taxonomyWriter
- The taxonomy to add categories and get their ordinals.CategoryListTokenizer
generating the category list for
this enhancement, with tokenizer
as it's input.Class<? extends CategoryProperty> getRetainableProperty()
CategoryProperty
class to be retained when creating
CategoryParentsStream
.CategoryProperty
class to be retained when creating
CategoryParentsStream
, or null
if there is no such
property.boolean equals(Object o)
Object.equals(Object)
, as it is
used in
EnhancementsPayloadIterator.getCategoryData(CategoryEnhancement)
.