From e4038142cc33cfcdf58fa2fdde9d8e66251ae4bf Mon Sep 17 00:00:00 2001 From: Mayya Sharipova Date: Thu, 12 Nov 2020 17:02:29 -0500 Subject: [PATCH] Revert "LUCENE-9569 Disalbe sort opt on _doc (#1959)" Re-enabled sort optimization on _doc This reverts commit 1c0f07ac03f0235adaf5c150f1c6656336e4282f. --- .../org/apache/lucene/search/comparators/DocComparator.java | 5 +---- .../lucene/search/TestFieldSortOptimizationSkipping.java | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/search/comparators/DocComparator.java b/lucene/core/src/java/org/apache/lucene/search/comparators/DocComparator.java index b9de45f3d983..c0b3e2efdbdf 100644 --- a/lucene/core/src/java/org/apache/lucene/search/comparators/DocComparator.java +++ b/lucene/core/src/java/org/apache/lucene/search/comparators/DocComparator.java @@ -40,11 +40,8 @@ public class DocComparator extends FieldComparator { /** Creates a new comparator based on document ids for {@code numHits} */ public DocComparator(int numHits, boolean reverse, int sortPost) { this.docIDs = new int[numHits]; - // Temporarily disable sort optimization for 8.7 release - this.enableSkipping = false; - // TODO: enable sort optimization after 8.7 release // skipping functionality is enabled if we are sorting by _doc in asc order as a primary sort - // this.enableSkipping = (reverse == false && sortPost == 0); + this.enableSkipping = (reverse == false && sortPost == 0); } @Override diff --git a/lucene/core/src/test/org/apache/lucene/search/TestFieldSortOptimizationSkipping.java b/lucene/core/src/test/org/apache/lucene/search/TestFieldSortOptimizationSkipping.java index e8f2d8547d0b..96e6ad941ebc 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestFieldSortOptimizationSkipping.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestFieldSortOptimizationSkipping.java @@ -321,7 +321,6 @@ public void testFloatSortOptimization() throws IOException { dir.close(); } - @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-9569") public void testDocSortOptimizationWithAfter() throws IOException { final Directory dir = newDirectory(); final IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig()); @@ -398,7 +397,7 @@ public void testDocSortOptimizationWithAfter() throws IOException { dir.close(); } - @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-9569") + public void testDocSortOptimization() throws IOException { final Directory dir = newDirectory(); final IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig());