From 89b6589eef7f74b26caad47bd475416a01f2e7cd Mon Sep 17 00:00:00 2001 From: Harsha Vamsi Kalluri Date: Fri, 19 Jul 2024 14:07:36 -0700 Subject: [PATCH] Delegate more instances to PointRangeQuery Signed-off-by: Harsha Vamsi Kalluri --- .../ApproximatePointRangeQuery.java | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/server/src/main/java/org/opensearch/search/approximate/ApproximatePointRangeQuery.java b/server/src/main/java/org/opensearch/search/approximate/ApproximatePointRangeQuery.java index 1f3ed7891587f..a96679cfa5246 100644 --- a/server/src/main/java/org/opensearch/search/approximate/ApproximatePointRangeQuery.java +++ b/server/src/main/java/org/opensearch/search/approximate/ApproximatePointRangeQuery.java @@ -28,8 +28,6 @@ import org.opensearch.search.sort.SortOrder; import java.io.IOException; -import java.util.Arrays; -import java.util.Objects; import java.util.function.BiFunction; import java.util.function.Predicate; @@ -554,26 +552,6 @@ public boolean isCacheable(LeafReaderContext ctx) { }; } - public String getField() { - return field; - } - - public int getNumDims() { - return numDims; - } - - public int getBytesPerDim() { - return bytesPerDim; - } - - public byte[] getLowerPoint() { - return lowerPoint.clone(); - } - - public byte[] getUpperPoint() { - return upperPoint.clone(); - } - @Override public final int hashCode() { return pointRangeQuery.hashCode(); @@ -584,16 +562,18 @@ public final boolean equals(Object o) { return pointRangeQuery.equals(o); } - private boolean equalsTo(ApproximatePointRangeQuery other) { - return Objects.equals(field, other.getField()) - && numDims == other.getNumDims() - && bytesPerDim == other.getBytesPerDim() - && Arrays.equals(lowerPoint, other.getLowerPoint()) - && Arrays.equals(upperPoint, other.getUpperPoint()); - } - @Override public final String toString(String field) { return pointRangeQuery.toString(field); } + + /** + * Returns a string of a single value in a human-readable format for debugging. This is used by + * {@link #toString()}. + * + * @param dimension dimension of the particular value + * @param value single value, never null + * @return human readable value for debugging + */ + protected abstract String toString(int dimension, byte[] value); }