mirror of https://github.com/apache/lucene.git
LUCENE-3686: CategoryEnhancement must override Object.equals()
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1230431 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ba60b2f98a
commit
d74db06ddf
|
@ -52,8 +52,8 @@ public interface CategoryEnhancement {
|
|||
* Get the bytes to be added to the category token payload for this
|
||||
* enhancement.
|
||||
* <p>
|
||||
* <b>NOTE</b>: The returned array is copied, it is recommended to allocate
|
||||
* a new one each time.
|
||||
* <b>NOTE</b>: The returned array is copied, it is recommended to allocate a
|
||||
* new one each time.
|
||||
* <p>
|
||||
* The bytes generated by this method are the input of
|
||||
* {@link #extractCategoryTokenData(byte[], int, int)}.
|
||||
|
@ -82,8 +82,8 @@ public interface CategoryEnhancement {
|
|||
Object extractCategoryTokenData(byte[] buffer, int offset, int length);
|
||||
|
||||
/**
|
||||
* Declarative method to indicate whether this enhancement generates
|
||||
* separate category list.
|
||||
* Declarative method to indicate whether this enhancement generates separate
|
||||
* category list.
|
||||
*
|
||||
* @return {@code true} if generates category list, else {@code false}.
|
||||
*/
|
||||
|
@ -97,9 +97,9 @@ public interface CategoryEnhancement {
|
|||
String getCategoryListTermText();
|
||||
|
||||
/**
|
||||
* Get the {@link CategoryListTokenizer} which generates the category list
|
||||
* for this enhancement. If {@link #generatesCategoryList()} returns
|
||||
* {@code false} this method will not be called.
|
||||
* Get the {@link CategoryListTokenizer} which generates the category list for
|
||||
* this enhancement. If {@link #generatesCategoryList()} returns {@code false}
|
||||
* this method will not be called.
|
||||
*
|
||||
* @param tokenizer
|
||||
* The input stream containing categories.
|
||||
|
@ -111,17 +111,22 @@ public interface CategoryEnhancement {
|
|||
* this enhancement, with {@code tokenizer} as it's input.
|
||||
*/
|
||||
CategoryListTokenizer getCategoryListTokenizer(TokenStream tokenizer,
|
||||
EnhancementsIndexingParams indexingParams,
|
||||
TaxonomyWriter taxonomyWriter);
|
||||
EnhancementsIndexingParams indexingParams, TaxonomyWriter taxonomyWriter);
|
||||
|
||||
/**
|
||||
* Get a {@link CategoryProperty} class to be retained when creating
|
||||
* {@link CategoryParentsStream}.
|
||||
*
|
||||
* @return the {@link CategoryProperty} class to be retained when creating
|
||||
* {@link CategoryParentsStream}, or {@code null} if there is no
|
||||
* such property.
|
||||
* {@link CategoryParentsStream}, or {@code null} if there is no such
|
||||
* property.
|
||||
*/
|
||||
Class<? extends CategoryProperty> getRetainableProperty();
|
||||
|
||||
/**
|
||||
* Category enhancements must override {@link Object#equals(Object)}, as it is
|
||||
* used in
|
||||
* {@link EnhancementsPayloadIterator#getCategoryData(CategoryEnhancement)}.
|
||||
*/
|
||||
public boolean equals(Object o);
|
||||
}
|
||||
|
|
|
@ -150,4 +150,17 @@ public class AssociationEnhancement implements CategoryEnhancement {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
return (o instanceof AssociationEnhancement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue