Skip to content

Commit 9632d5e

Browse files
Adjustments
1 parent 1cc73d2 commit 9632d5e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

server/src/main/java/org/elasticsearch/index/fielddata/IndexNumericFieldData.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,12 @@ public final SortField sortField(
9696
* 3. We Aren't using max or min to resolve the duplicates.
9797
* 4. We have to cast the results to another type.
9898
*/
99-
boolean optimizeSortWithPoints = isIndexed()
100-
&& nested == null
101-
&& (sortMode == MultiValueMode.MAX || sortMode == MultiValueMode.MIN)
102-
&& targetNumericType == getNumericType();
103-
if (sortRequiresCustomComparator() || optimizeSortWithPoints == false) {
99+
boolean requiresCustomComparator = nested != null
100+
|| (sortMode != MultiValueMode.MAX && sortMode != MultiValueMode.MIN)
101+
|| targetNumericType != getNumericType();
102+
if (sortRequiresCustomComparator() || requiresCustomComparator) {
104103
SortField sortField = new SortField(getFieldName(), source, reverse);
105-
sortField.setOptimizeSortWithPoints(optimizeSortWithPoints);
104+
sortField.setOptimizeSortWithPoints(requiresCustomComparator == false && isIndexed());
106105
return sortField;
107106
}
108107

0 commit comments

Comments
 (0)