Index: src/java/org/apache/lucene/search/RangeFilter.java =================================================================== --- src/java/org/apache/lucene/search/RangeFilter.java (revision 291801) +++ src/java/org/apache/lucene/search/RangeFilter.java (working copy) @@ -167,4 +167,30 @@ buffer.append(includeUpper ? "]" : "}"); return buffer.toString(); } + + /** Returns true if o is equal to this. */ + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof RangeFilter)) return false; + RangeFilter other = (RangeFilter) o; + + if (!this.fieldName.equals(other.fieldName) + || this.includeLower != other.includeLower + || this.includeUpper != other.includeUpper + ) { return false; } + if (this.lowerTerm != null ? !this.lowerTerm.equals(other.lowerTerm) : other.lowerTerm != null) return false; + if (this.upperTerm != null ? !this.upperTerm.equals(other.upperTerm) : other.upperTerm != null) return false; + return true; + } + + /** Returns a hash code value for this object.*/ + public int hashCode() { + int h = fieldName.hashCode(); + h ^= lowerTerm != null ? lowerTerm.hashCode() : 0xB6ECE882; + h = (h << 1) | (h >>> 31); + h ^= (upperTerm != null ? (upperTerm.hashCode()) : 0x91BEC2C2); + h ^= (includeLower ? 0xD484B933 : 0x2A4AB03C) + ^ (includeUpper ? 0x6AE423AC : 0x7BB0BE14); + return h; + } } Index: src/java/org/apache/lucene/search/CachingWrapperFilter.java =================================================================== --- src/java/org/apache/lucene/search/CachingWrapperFilter.java (revision 291801) +++ src/java/org/apache/lucene/search/CachingWrapperFilter.java (working copy) @@ -68,4 +68,13 @@ public String toString() { return "CachingWrapperFilter("+filter+")"; } + + public boolean equals(Object o) { + if (!(o instanceof CachingWrapperFilter)) return false; + return this.filter.equals(((CachingWrapperFilter)o).filter); + } + + public int hashCode() { + return filter.hashCode() ^ 0x1117BF25; + } } Index: src/java/org/apache/lucene/search/QueryFilter.java =================================================================== --- src/java/org/apache/lucene/search/QueryFilter.java (revision 291801) +++ src/java/org/apache/lucene/search/QueryFilter.java (working copy) @@ -75,4 +75,13 @@ public String toString() { return "QueryFilter("+query+")"; } + + public boolean equals(Object o) { + if (!(o instanceof QueryFilter)) return false; + return this.query.equals(((QueryFilter)o).query); + } + + public int hashCode() { + return query.hashCode() ^ 0x923F64B9; + } }