From 48c3f3548e87004aa33d07f61b98c273805dd83c Mon Sep 17 00:00:00 2001 From: Houston Putman Date: Tue, 15 Oct 2024 17:08:57 -0500 Subject: [PATCH] Add in the sort that was removed accidentally --- lucene/core/src/java/org/apache/lucene/util/Selector.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lucene/core/src/java/org/apache/lucene/util/Selector.java b/lucene/core/src/java/org/apache/lucene/util/Selector.java index dfbe19b4235..5a05400af59 100644 --- a/lucene/core/src/java/org/apache/lucene/util/Selector.java +++ b/lucene/core/src/java/org/apache/lucene/util/Selector.java @@ -16,6 +16,8 @@ */ package org.apache.lucene.util; +import java.util.Arrays; + /** * An implementation of a selection algorithm, ie. computing the k-th greatest value from a * collection. @@ -39,6 +41,7 @@ public abstract class Selector { public void multiSelect(int from, int to, int[] k) { // k needs to be sorted, so copy the array k = ArrayUtil.copyArray(k); + Arrays.sort(k); checkMultiArgs(from, to, k); multiSelect(from, to, k, 0, k.length); }