lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbern...@apache.org
Subject [42/50] lucene-solr:master: SOLR-10094: /export handler (master only) loses the sort deep into the result set
Date Wed, 15 Feb 2017 20:47:54 GMT
SOLR-10094: /export handler (master only) loses the sort deep into the result set


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

Branch: refs/heads/master
Commit: a9cf1503b59c24e8093459609dd56bb5339cda54
Parents: 4ea97b0
Author: Joel Bernstein <jbernste@apache.org>
Authored: Sat Feb 4 23:48:03 2017 -0500
Committer: Joel Bernstein <jbernste@apache.org>
Committed: Wed Feb 8 13:01:31 2017 -0500

----------------------------------------------------------------------
 .../java/org/apache/solr/handler/ExportWriter.java | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a9cf1503/solr/core/src/java/org/apache/solr/handler/ExportWriter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/ExportWriter.java b/solr/core/src/java/org/apache/solr/handler/ExportWriter.java
index e432f94..8bdd959 100644
--- a/solr/core/src/java/org/apache/solr/handler/ExportWriter.java
+++ b/solr/core/src/java/org/apache/solr/handler/ExportWriter.java
@@ -1254,7 +1254,6 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable {
   class StringValue implements SortValue {
 
     protected SortedDocValues vals;
-    protected SortedDocValues segmentVals[];
 
     protected MultiDocValues.OrdinalMap ordinalMap;
     protected LongValues globalOrds;
@@ -1264,11 +1263,11 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable
{
     protected int segment;
     protected int currentOrd;
     protected IntComp comp;
+    protected int lastDocID;
 
     public StringValue(SortedDocValues vals, String field, IntComp comp)  {
       this.vals = vals;
       if(vals instanceof MultiDocValues.MultiSortedDocValues) {
-        this.segmentVals = ((MultiDocValues.MultiSortedDocValues) vals).values;
         this.ordinalMap = ((MultiDocValues.MultiSortedDocValues) vals).mapping;
       }
       this.field = field;
@@ -1281,6 +1280,13 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable
{
     }
 
     public void setCurrentValue(int docId) throws IOException {
+
+      if (docId < lastDocID) {
+        throw new AssertionError("docs were sent out-of-order: lastDocID=" + lastDocID +
" vs doc=" + docId);
+      }
+
+      lastDocID = docId;
+
       if (docId > currentVals.docID()) {
         currentVals.advance(docId);
       }
@@ -1301,14 +1307,13 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable
{
       this.currentOrd = v.currentOrd;
     }
 
-    public void setNextReader(LeafReaderContext context) {
+    public void setNextReader(LeafReaderContext context) throws IOException {
       segment = context.ord;
       if(ordinalMap != null) {
         globalOrds = ordinalMap.getGlobalOrds(segment);
-        currentVals = segmentVals[segment];
-      } else {
-        currentVals = vals;
       }
+      currentVals = DocValues.getSorted(context.reader(), field);
+      lastDocID = 0;
     }
 
     public void reset() {


Mime
View raw message