LUCENE-1587: RangeQuery#equals() could consider a RangeQuery without a collator equal to one with a collator.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@763840 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2009-04-10 00:40:31 +00:00
parent ca6451958b
commit d74d56d9c9
3 changed files with 12 additions and 3 deletions

View File

@ -57,7 +57,7 @@ API Changes
Rutherglen via Mike McCandless) Rutherglen via Mike McCandless)
9. LUCENE-1186: Add Analyzer.close() to free internal ThreadLocal 9. LUCENE-1186: Add Analyzer.close() to free internal ThreadLocal
resources. (Christian Kohlschütter via Mike McCandless) resources. (Christian Kohlsch<EFBFBD>tter via Mike McCandless)
10. LUCENE-652: Added org.apache.lucene.document.CompressionTools, to 10. LUCENE-652: Added org.apache.lucene.document.CompressionTools, to
enable compressing & decompressing binary content, external to enable compressing & decompressing binary content, external to
@ -96,7 +96,7 @@ Bug fixes
(Mike McCandless via Doug Sale) (Mike McCandless via Doug Sale)
6. LUCENE-1186: Add Analyzer.close() to free internal ThreadLocal 6. LUCENE-1186: Add Analyzer.close() to free internal ThreadLocal
resources. (Christian Kohlschütter via Mike McCandless) resources. (Christian Kohlsch<EFBFBD>tter via Mike McCandless)
7. LUCENE-1327: Fix TermSpans#skipTo() to behave as specified in javadocs 7. LUCENE-1327: Fix TermSpans#skipTo() to behave as specified in javadocs
of Terms#skipTo(). (Michael Busch) of Terms#skipTo(). (Michael Busch)
@ -113,6 +113,11 @@ Bug fixes
omitTermFreqAndPositions=false (though these values are unused). omitTermFreqAndPositions=false (though these values are unused).
(Uwe Schindler via Mike McCandless) (Uwe Schindler via Mike McCandless)
10. LUCENE-1587: RangeQuery#equals() could consider a RangeQuery
without a collator equal to one with a collator.
(Mark Platvoet via Mark Miller)
New features New features
1. LUCENE-1411: Added expert API to open an IndexWriter on a prior 1. LUCENE-1411: Added expert API to open an IndexWriter on a prior

View File

@ -204,7 +204,7 @@ public class RangeQuery extends MultiTermQuery {
if (this.field != other.field // interned comparison if (this.field != other.field // interned comparison
|| this.includeLower != other.includeLower || this.includeLower != other.includeLower
|| this.includeUpper != other.includeUpper || this.includeUpper != other.includeUpper
|| (this.collator != null && ! this.collator.equals(other.collator)) || (this.collator != null && ! this.collator.equals(other.collator) || (this.collator == null && other.collator != null))
) { return false; } ) { return false; }
String lowerVal = this.lowerTerm == null ? null : lowerTerm.text(); String lowerVal = this.lowerTerm == null ? null : lowerTerm.text();
String upperVal = this.upperTerm == null ? null : upperTerm.text(); String upperVal = this.upperTerm == null ? null : upperTerm.text();

View File

@ -145,6 +145,10 @@ public class TestRangeQuery extends LuceneTestCase {
query = new RangeQuery("content", "A", "C", false, false); query = new RangeQuery("content", "A", "C", false, false);
other = new RangeQuery("content", "A", "C", true, true); other = new RangeQuery("content", "A", "C", true, true);
assertFalse("queries with different inclusive are not equal", query.equals(other)); assertFalse("queries with different inclusive are not equal", query.equals(other));
query = new RangeQuery("content", "A", "C", false, false);
other = new RangeQuery("content", "A", "C", false, false, Collator.getInstance());
assertFalse("a query with a collator is not equal to one without", query.equals(other));
} }
public void testExclusiveCollating() throws Exception { public void testExclusiveCollating() throws Exception {