You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2012/01/12 08:40:10 UTC
svn commit: r1230429 - in /lucene/dev/branches/branch_3x/lucene/contrib:
CHANGES.txt
facet/src/java/org/apache/lucene/facet/enhancements/CategoryEnhancement.java
facet/src/java/org/apache/lucene/facet/enhancements/association/AssociationEnhancement.java
Author: shaie
Date: Thu Jan 12 07:40:10 2012
New Revision: 1230429
URL: http://svn.apache.org/viewvc?rev=1230429&view=rev
Log:
LUCENE-3686: CategoryEnhancement must override Object.equals()
Modified:
lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt
lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/CategoryEnhancement.java
lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/association/AssociationEnhancement.java
Modified: lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt?rev=1230429&r1=1230428&r2=1230429&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt Thu Jan 12 07:40:10 2012
@@ -64,6 +64,9 @@ Bug Fixes
This way if the synonym token is used for highlighting, it will
cover all tokens it had matched. (Koji Sekiguchi, Robert Muir,
Mike McCandless)
+
+ * LUCENE-3686: CategoryEnhancement must override Object.equals(Object).
+ (Sivan Yogev via Shai Erera)
Documentation
Modified: lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/CategoryEnhancement.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/CategoryEnhancement.java?rev=1230429&r1=1230428&r2=1230429&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/CategoryEnhancement.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/CategoryEnhancement.java Thu Jan 12 07:40:10 2012
@@ -47,24 +47,24 @@ import org.apache.lucene.facet.taxonomy.
* @lucene.experimental
*/
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)}.
*
* @param categoryAttribute
- * The attribute of the category.
+ * The attribute of the category.
* @return The bytes to be added to the category token payload for this
* enhancement.
*/
byte[] getCategoryTokenBytes(CategoryAttribute categoryAttribute);
-
+
/**
* Get the data of this enhancement from a category token payload.
* <p>
@@ -72,56 +72,61 @@ public interface CategoryEnhancement {
* {@link #getCategoryTokenBytes(CategoryAttribute)}.
*
* @param buffer
- * The payload buffer.
+ * The payload buffer.
* @param offset
- * The offset of this enhancement's data in the buffer.
+ * The offset of this enhancement's data in the buffer.
* @param length
- * The length of this enhancement's data (bytes).
+ * The length of this enhancement's data (bytes).
* @return An Object containing the data.
*/
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}.
*/
boolean generatesCategoryList();
-
+
/**
* Returns the text of this enhancement's category list term.
*
* @return The text of this enhancement's category list term.
*/
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.
+ * The input stream containing categories.
* @param indexingParams
- * The indexing params to use.
+ * The indexing params to use.
* @param taxonomyWriter
- * The taxonomy to add categories and get their ordinals.
+ * The taxonomy to add categories and get their ordinals.
* @return A {@link CategoryListTokenizer} generating the category list for
* 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);
}
Modified: lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/association/AssociationEnhancement.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/association/AssociationEnhancement.java?rev=1230429&r1=1230428&r2=1230429&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/association/AssociationEnhancement.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/facet/src/java/org/apache/lucene/facet/enhancements/association/AssociationEnhancement.java Thu Jan 12 07:40:10 2012
@@ -150,4 +150,17 @@ public class AssociationEnhancement impl
return null;
}
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ return (o instanceof AssociationEnhancement);
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
}