public class AssociationEnhancement extends Object implements CategoryEnhancement
CategoryEnhancement
for adding associations data to the index
(categories with AssociationProperty
s).Constructor and Description |
---|
AssociationEnhancement() |
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.
|
static AssociationProperty |
getAssociationProperty(CategoryAttribute categoryAttribute) |
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 . |
int |
hashCode() |
static boolean |
isAssociationProperty(Class<? extends CategoryProperty> clazz)
For a given class which extends a CategoryProperty, answers whether it is
an instance of AssociationProperty (AP) or not.
|
public static boolean isAssociationProperty(Class<? extends CategoryProperty> clazz)
instanceof
. It has two HashSets - one for classes which are
an extension to AP and one for the classes which are not. Whenever a
property class is introduced:
public boolean generatesCategoryList()
CategoryEnhancement
generatesCategoryList
in interface CategoryEnhancement
true
if generates category list, else false
.public String getCategoryListTermText()
CategoryEnhancement
getCategoryListTermText
in interface CategoryEnhancement
public CategoryListTokenizer getCategoryListTokenizer(TokenStream tokenizer, EnhancementsIndexingParams indexingParams, TaxonomyWriter taxonomyWriter)
CategoryEnhancement
CategoryListTokenizer
which generates the category list for
this enhancement. If CategoryEnhancement.generatesCategoryList()
returns false
this method will not be called.getCategoryListTokenizer
in interface CategoryEnhancement
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.public byte[] getCategoryTokenBytes(CategoryAttribute categoryAttribute)
CategoryEnhancement
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
CategoryEnhancement.extractCategoryTokenData(byte[], int, int)
.
getCategoryTokenBytes
in interface CategoryEnhancement
categoryAttribute
- The attribute of the category.public static AssociationProperty getAssociationProperty(CategoryAttribute categoryAttribute)
public Object extractCategoryTokenData(byte[] buffer, int offset, int length)
CategoryEnhancement
The input bytes for this method are generated in
CategoryEnhancement.getCategoryTokenBytes(CategoryAttribute)
.
extractCategoryTokenData
in interface CategoryEnhancement
buffer
- The payload buffer.offset
- The offset of this enhancement's data in the buffer.length
- The length of this enhancement's data (bytes).public Class<? extends CategoryProperty> getRetainableProperty()
CategoryEnhancement
CategoryProperty
class to be retained when creating
CategoryParentsStream
.getRetainableProperty
in interface CategoryEnhancement
CategoryProperty
class to be retained when creating
CategoryParentsStream
, or null
if there is no such
property.public boolean equals(Object o)
CategoryEnhancement
Object.equals(Object)
, as it is
used in
EnhancementsPayloadIterator.getCategoryData(CategoryEnhancement)
.equals
in interface CategoryEnhancement
equals
in class Object