From a28c8cc95a8f6ae7c9603fda94e86f6bb526bd08 Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Thu, 5 Dec 2024 19:43:41 -0800 Subject: [PATCH] Early termination with PointValues Signed-off-by: Prudhvi Godithi --- .../org/opensearch/index/mapper/DateFieldMapper.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/org/opensearch/index/mapper/DateFieldMapper.java b/server/src/main/java/org/opensearch/index/mapper/DateFieldMapper.java index aece93b90aa18..6ae2f7608f875 100644 --- a/server/src/main/java/org/opensearch/index/mapper/DateFieldMapper.java +++ b/server/src/main/java/org/opensearch/index/mapper/DateFieldMapper.java @@ -612,6 +612,12 @@ public Relation isFieldWithinQuery( if (isSearchable() == false && hasDocValues()) { return Relation.INTERSECTS; } + + if (PointValues.size(reader, name()) == 0) { + // no points, so nothing matches + return Relation.DISJOINT; + } + if (dateParser == null) { dateParser = this.dateMathParser; } @@ -638,11 +644,6 @@ public Relation isFieldWithinQuery( } } - if (PointValues.size(reader, name()) == 0) { - // no points, so nothing matches - return Relation.DISJOINT; - } - long minValue = LongPoint.decodeDimension(PointValues.getMinPackedValue(reader, name()), 0); long maxValue = LongPoint.decodeDimension(PointValues.getMaxPackedValue(reader, name()), 0);