mirror of
https://github.com/apache/lucene.git
synced 2025-02-21 01:18:45 +00:00
Fix issue where an inclusive range query would include the nearest term in the index above a non-existant specified upper term.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149609 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e9161ac365
commit
4c3e4ce685
@ -169,13 +169,16 @@ public final class RangeQuery extends Query
|
||||
if (!checkLower || term.text().compareTo(lowerText) > 0)
|
||||
{
|
||||
checkLower = false;
|
||||
// if exclusive and this is last term, don't count it and break
|
||||
if (!inclusive && (upperTerm != null) && (upperTerm.compareTo(term) <= 0)) break;
|
||||
if (upperTerm != null)
|
||||
{
|
||||
int compare = upperTerm.compareTo(term);
|
||||
/* if beyond the upper term, or is exclusive and
|
||||
* this is equal to the upper term, break out */
|
||||
if ((compare < 0) || (!inclusive && compare == 0)) break;
|
||||
}
|
||||
TermQuery tq = new TermQuery(term); // found a match
|
||||
tq.setBoost(boost); // set the boost
|
||||
q.add(tq, false, false); // add to q
|
||||
// if inclusive just added last term, break out
|
||||
if (inclusive && (upperTerm != null) && (upperTerm.compareTo(term) <= 0)) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user