lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbern...@apache.org
Subject svn commit: r1620031 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java
Date Sat, 23 Aug 2014 14:29:02 GMT
Author: jbernste
Date: Sat Aug 23 14:29:02 2014
New Revision: 1620031

URL: http://svn.apache.org/r1620031
Log:
SOLR-6407: SortingResponseWriter String sorting broken on single segment indexes

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java?rev=1620031&r1=1620030&r2=1620031&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java
Sat Aug 23 14:29:02 2014
@@ -444,6 +444,10 @@ public class SortingResponseWriter imple
       }
       return docId+docBase < sd.docId+sd.docBase;
     }
+
+    public String toString() {
+      return "";
+    }
   }
 
   class SingleValueSortDoc extends SortDoc {
@@ -496,6 +500,10 @@ public class SortingResponseWriter imple
       SingleValueSortDoc sd = (SingleValueSortDoc)o;
       return value1.compareTo(sd.value1);
     }
+
+    public String toString() {
+      return docId+":"+value1.toString();
+    }
   }
 
   class DoubleValueSortDoc extends SingleValueSortDoc {
@@ -1088,8 +1096,10 @@ public class SortingResponseWriter imple
 
     public StringValue(SortedDocValues vals, String field, IntComp comp)  {
       this.vals = vals;
-      this.segmentVals = ((MultiDocValues.MultiSortedDocValues) vals).values;
-      this.ordinalMap = ((MultiDocValues.MultiSortedDocValues) vals).mapping;
+      if(vals instanceof  MultiDocValues.MultiSortedDocValues) {
+        this.segmentVals = ((MultiDocValues.MultiSortedDocValues) vals).values;
+        this.ordinalMap = ((MultiDocValues.MultiSortedDocValues) vals).mapping;
+      }
       this.field = field;
       this.comp = comp;
       this.currentOrd = comp.resetValue();
@@ -1104,7 +1114,11 @@ public class SortingResponseWriter imple
       if(ord < 0) {
         currentOrd = -1;
       } else {
-        currentOrd = (int)globalOrds.get(ord);
+        if(globalOrds != null) {
+          currentOrd = (int)globalOrds.get(ord);
+        } else {
+          currentOrd = ord;
+        }
       }
     }
 
@@ -1115,8 +1129,12 @@ public class SortingResponseWriter imple
 
     public void setNextReader(AtomicReaderContext context) {
       segment = context.ord;
-      globalOrds = ordinalMap.getGlobalOrds(segment);
-      currentVals = segmentVals[segment];
+      if(ordinalMap != null) {
+        globalOrds = ordinalMap.getGlobalOrds(segment);
+        currentVals = segmentVals[segment];
+      } else {
+        currentVals = vals;
+      }
     }
 
     public void reset() {
@@ -1127,6 +1145,10 @@ public class SortingResponseWriter imple
       StringValue sv = (StringValue)o;
       return comp.compare(currentOrd, sv.currentOrd);
     }
+
+    public String toString() {
+      return Integer.toString(this.currentOrd);
+    }
   }
 
   protected abstract class FieldWriter {



Mime
View raw message