LUCENE-7449: fix CROSSES queries so they don't match all docs when internal nodes are equal

This commit is contained in:
Nicholas Knize 2017-03-11 18:40:55 -06:00
parent a3f4896359
commit f3ba7f4105
1 changed files with 2 additions and 2 deletions

View File

@ -171,8 +171,8 @@ abstract class RangeFieldQuery extends Query {
// if query crosses, docs need to be further scrutinized // if query crosses, docs need to be further scrutinized
byte[] range = getInternalRange(values.getMinPackedValue(), values.getMaxPackedValue()); byte[] range = getInternalRange(values.getMinPackedValue(), values.getMaxPackedValue());
// if the internal node is not equal and not contained by the query, all docs do not match // if the internal node is not equal and not contained by the query, all docs do not match
if (!Arrays.equals(ranges, range) if (queryType == QueryType.CROSSES || (!Arrays.equals(ranges, range)
&& (!target.contains(range) || queryType != QueryType.WITHIN)) { && (target.contains(range) == false || queryType != QueryType.WITHIN))) {
allDocsMatch = false; allDocsMatch = false;
} }
} else { } else {