From 2239618746671ccdf6c20105d14442413d226056 Mon Sep 17 00:00:00 2001 From: Harsha Vamsi Kalluri Date: Fri, 8 Dec 2023 12:54:00 -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..1b19b0e696f17 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