lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject lucene-solr:branch_6x: LUCENE-7574: Fix more index sorting test failures.
Date Fri, 25 Nov 2016 15:53:34 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x c862a88e5 -> 6f4104c71


LUCENE-7574: Fix more index sorting test failures.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/6f4104c7
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6f4104c7
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6f4104c7

Branch: refs/heads/branch_6x
Commit: 6f4104c710978347b99c3f5a6263f25d9b89f978
Parents: c862a88
Author: Adrien Grand <jpountz@gmail.com>
Authored: Fri Nov 25 16:52:15 2016 +0100
Committer: Adrien Grand <jpountz@gmail.com>
Committed: Fri Nov 25 16:52:15 2016 +0100

----------------------------------------------------------------------
 lucene/core/src/java/org/apache/lucene/index/MultiSorter.java  | 6 +++---
 .../src/test/org/apache/lucene/index/TestIndexSorting.java     | 5 ++++-
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6f4104c7/lucene/core/src/java/org/apache/lucene/index/MultiSorter.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/MultiSorter.java b/lucene/core/src/java/org/apache/lucene/index/MultiSorter.java
index 6680460..cfcbb48 100644
--- a/lucene/core/src/java/org/apache/lucene/index/MultiSorter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/MultiSorter.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.lucene.index.MergeState.DocMap;
-import org.apache.lucene.index.MergeState;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.Bits;
@@ -156,10 +155,11 @@ final class MultiSorter {
         docStarts[readers.size()] = multiReader.maxDoc();
         final SortedDocValues sorted = MultiDocValues.getSortedValues(multiReader, leafValues,
docStarts);
         final int missingOrd;
+        // no need to take sortField.getReverse() into account here since we apply reverseMul
on top of the ordinal comparison later on
         if (sortField.getMissingValue() == SortField.STRING_LAST) {
-          missingOrd = sortField.getReverse() ? Integer.MIN_VALUE : Integer.MAX_VALUE;
+          missingOrd = Integer.MAX_VALUE;
         } else {
-          missingOrd = sortField.getReverse() ? Integer.MAX_VALUE : Integer.MIN_VALUE;
+          missingOrd = Integer.MIN_VALUE;
         }
 
         return new CrossReaderComparator() {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6f4104c7/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
index 93acc3b..266205e 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
@@ -102,7 +102,10 @@ public class TestIndexSorting extends LuceneTestCase {
           return new PointsWriter() {
             @Override
             public void merge(MergeState mergeState) throws IOException {
-              assertEquals(needsIndexSort, mergeState.needsIndexSort);
+              // For single segment merge we cannot infer if the segment is already sorted
or not.
+              if (mergeState.docMaps.length > 1) {
+                assertEquals(needsIndexSort, mergeState.needsIndexSort);
+              }
               ++ numCalls;
               writer.merge(mergeState);
             }


Mime
View raw message