From 2f3d203960ccd1c4d4fc660daa0db0747720bc9f Mon Sep 17 00:00:00 2001 From: Harsha Vamsi Kalluri Date: Fri, 8 Dec 2023 13:10:39 -0800 Subject: [PATCH] Change unsigned exact query to be consistent Signed-off-by: Harsha Vamsi Kalluri --- .../org/opensearch/index/mapper/NumberFieldMapper.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/index/mapper/NumberFieldMapper.java b/server/src/main/java/org/opensearch/index/mapper/NumberFieldMapper.java index aaff6cb59ef64..003167d86f5b6 100644 --- a/server/src/main/java/org/opensearch/index/mapper/NumberFieldMapper.java +++ b/server/src/main/java/org/opensearch/index/mapper/NumberFieldMapper.java @@ -1000,7 +1000,15 @@ public Query termQuery(String field, Object value, boolean hasDocValues, boolean return Queries.newMatchNoDocsQuery("Value [" + value + "] has a decimal part"); } BigInteger v = parse(value, true); - return rangeQuery(field, v, v, true, true, hasDocValues, isSearchable, null); + if (isSearchable && hasDocValues) { + Query query = BigIntegerPoint.newExactQuery(field, v); + Query dvQuery = SortedUnsignedLongDocValuesRangeQuery.newSlowRangeQuery(field, v, v); + return new IndexOrDocValuesQuery(query, dvQuery); + } + if (hasDocValues) { + return SortedUnsignedLongDocValuesRangeQuery.newSlowRangeQuery(field, v, v); + } + return BigIntegerPoint.newExactQuery(field, v); } @Override