gsmiller commented on code in PR #12587:
URL: https://github.com/apache/lucene/pull/12587#discussion_r1352934399


##########
lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java:
##########
@@ -112,7 +113,23 @@ private static PrefixCodedTerms packTerms(String field, 
Collection<BytesRef> ter
     boolean sorted =
         terms instanceof SortedSet && ((SortedSet<BytesRef>) 
terms).comparator() == null;
     if (sorted == false) {
-      ArrayUtil.timSort(sortedTerms);
+      new StringSorter(BytesRefComparator.NATURAL) {
+
+        @Override
+        protected void get(BytesRefBuilder builder, BytesRef result, int i) {
+          BytesRef term = sortedTerms[i];
+          result.length = term.length;
+          result.offset = term.offset;
+          result.bytes = term.bytes;
+        }
+
+        @Override
+        protected void swap(int i, int j) {
+          BytesRef b = sortedTerms[i];
+          sortedTerms[i] = sortedTerms[j];
+          sortedTerms[j] = b;
+        }
+      }.sort(0, sortedTerms.length);

Review Comment:
   Oh right, that makes sense to me. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to