You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2017/01/20 14:06:41 UTC
lucene-solr:jira/solr-5944: SOLR-5944: Fix compilation error due to
merge with LUCENE-7643
Repository: lucene-solr
Updated Branches:
refs/heads/jira/solr-5944 829f5293b -> 6ff5ce1e4
SOLR-5944: Fix compilation error due to merge with LUCENE-7643
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/6ff5ce1e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6ff5ce1e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6ff5ce1e
Branch: refs/heads/jira/solr-5944
Commit: 6ff5ce1e45cedc5012de245e6fd5a6aadc39bc50
Parents: 829f529
Author: Ishan Chattopadhyaya <is...@apache.org>
Authored: Fri Jan 20 19:36:28 2017 +0530
Committer: Ishan Chattopadhyaya <is...@apache.org>
Committed: Fri Jan 20 19:36:28 2017 +0530
----------------------------------------------------------------------
.../java/org/apache/solr/schema/PointField.java | 41 +++++++++++++++++---
1 file changed, 35 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6ff5ce1e/solr/core/src/java/org/apache/solr/schema/PointField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/schema/PointField.java b/solr/core/src/java/org/apache/solr/schema/PointField.java
index fbe38de..5bd50e8 100644
--- a/solr/core/src/java/org/apache/solr/schema/PointField.java
+++ b/solr/core/src/java/org/apache/solr/schema/PointField.java
@@ -27,7 +27,7 @@ import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.document.StoredField;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.queries.function.ValueSource;
-import org.apache.lucene.search.DocValuesRangeQuery;
+import org.apache.lucene.search.MatchNoDocsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.SortedSetSelector;
import org.apache.lucene.util.BytesRef;
@@ -162,21 +162,21 @@ public abstract class PointField extends PrimitiveFieldType {
switch (getType()) {
case INTEGER:
- return DocValuesRangeQuery.newLongRange(field.getName(),
+ return numericDocValuesRangeQuery(field.getName(),
min == null ? null : (long) Integer.parseInt(min),
max == null ? null : (long) Integer.parseInt(max),
minInclusive, maxInclusive);
case FLOAT:
return getRangeQueryForFloatDoubleDocValues(field, min, max, minInclusive, maxInclusive);
case LONG:
- return DocValuesRangeQuery.newLongRange(field.getName(),
+ return numericDocValuesRangeQuery(field.getName(),
min == null ? null : Long.parseLong(min),
max == null ? null : Long.parseLong(max),
minInclusive, maxInclusive);
case DOUBLE:
return getRangeQueryForFloatDoubleDocValues(field, min, max, minInclusive, maxInclusive);
case DATE:
- return DocValuesRangeQuery.newLongRange(field.getName(),
+ return numericDocValuesRangeQuery(field.getName(),
min == null ? null : DateMathParser.parseMath(null, min).getTime(),
max == null ? null : DateMathParser.parseMath(null, max).getTime(),
minInclusive, maxInclusive);
@@ -223,16 +223,45 @@ public abstract class PointField extends PrimitiveFieldType {
} else { // If both max and min are negative (or -0d), then issue range query with max and min reversed
if ((minVal == null || minVal.doubleValue() < 0d || minBits == minusZeroBits) &&
(maxVal != null && (maxVal.doubleValue() < 0d || maxBits == minusZeroBits))) {
- query = DocValuesRangeQuery.newLongRange
+ query = numericDocValuesRangeQuery
(fieldName, maxBits, (min == null ? negativeInfinityBits : minBits), maxInclusive, minInclusive);
} else { // If both max and min are positive, then issue range query
- query = DocValuesRangeQuery.newLongRange
+ query = numericDocValuesRangeQuery
(fieldName, minBits, (max == null ? positiveInfinityBits : maxBits), minInclusive, maxInclusive);
}
}
return query;
}
+ private static Query numericDocValuesRangeQuery(
+ String field,
+ Number lowerValue, Number upperValue,
+ boolean lowerInclusive, boolean upperInclusive) {
+
+ long actualLowerValue = Long.MIN_VALUE;
+ if (lowerValue != null) {
+ actualLowerValue = lowerValue.longValue();
+ if (lowerInclusive == false) {
+ if (actualLowerValue == Long.MAX_VALUE) {
+ return new MatchNoDocsQuery();
+ }
+ ++actualLowerValue;
+ }
+ }
+
+ long actualUpperValue = Long.MAX_VALUE;
+ if (upperValue != null) {
+ actualUpperValue = upperValue.longValue();
+ if (upperInclusive == false) {
+ if (actualUpperValue == Long.MIN_VALUE) {
+ return new MatchNoDocsQuery();
+ }
+ --actualUpperValue;
+ }
+ }
+ return NumericDocValuesField.newRangeQuery(field, actualLowerValue, actualUpperValue);
+ }
+
@Override
public String storedToReadable(IndexableField f) {
return toExternal(f);