From 7c966a600383548ed4ff9fa2ae8b29645dc61ddf Mon Sep 17 00:00:00 2001 From: gashutos Date: Thu, 14 Sep 2023 13:42:00 +0530 Subject: [PATCH] Index sort print --- .../opensearch/index/fielddata/IndexNumericFieldData.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/opensearch/index/fielddata/IndexNumericFieldData.java b/server/src/main/java/org/opensearch/index/fielddata/IndexNumericFieldData.java index 639b3f435b6a8..380b5dc60cc3f 100644 --- a/server/src/main/java/org/opensearch/index/fielddata/IndexNumericFieldData.java +++ b/server/src/main/java/org/opensearch/index/fielddata/IndexNumericFieldData.java @@ -109,6 +109,8 @@ public void modifySortFieldTypeForIndexSortIfNeeded() { */ public abstract NumericType getNumericType(); + private boolean indexSortField; + /** * Returns the {@link SortField} to used for sorting. * Values are casted to the provided targetNumericType type if it doesn't @@ -146,8 +148,8 @@ public final SortField sortField( SortField sortField = new SortedNumericSortField(getFieldName(), getNumericType().sortFieldType, reverse, selectorType); sortField.setMissingValue(source.missingObject(missingValue, reverse)); System.out.println(sortField); - if(reverse == false) { - throw new UnsupportedOperationException(); + if(indexSortField) { + sortField.setOptimizeSortWithPoints(false); } return sortField; } @@ -168,6 +170,7 @@ public final SortField sortField(Object missingValue, MultiValueMode sortMode, N public final SortField indexSortField(Object missingValue, MultiValueMode sortMode, Nested nested, boolean reverse) { System.out.println("CHETAN LOGS : coming here...."); getNumericType().modifySortFieldTypeForIndexSortIfNeeded(); + this.indexSortField = true; return sortField(getNumericType(), missingValue, sortMode, nested, reverse); }