Skip to content

Apache Lucene open-source search software

LUCENE-1764 minor tweaks to SampleComparable so that it causes more sane FieldCache usage in contrib/remote tests

Chris M. Hostetter5a21421a615c
diff --git a/src/test/org/apache/lucene/search/SampleComparable.java b/src/test/org/apache/lucene/search/SampleComparable.java
index 2beedf1142e..3c5d636a66b 100644
--- a/src/test/org/apache/lucene/search/SampleComparable.java
+++ b/src/test/org/apache/lucene/search/SampleComparable.java
@@ -134,11 +134,15 @@ implements Comparable, Serializable {
};
}
- public static SortComparator getComparator() {
- return new SortComparator() {
+ private static final class InnerSortComparator extends SortComparator {
protected Comparable getComparable (String termtext) {
return new SampleComparable (termtext);
}
+ public int hashCode() { return this.getClass().getName().hashCode(); }
+ public boolean equals(Object that) { return this.getClass().equals(that.getClass()); }
};
+
+ public static SortComparator getComparator() {
+ return new InnerSortComparator();
}
-}
\ No newline at end of file
+}