SOLR-6407: SortingResponseWriter String sorting broken on single segment indexes

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1620029 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joel Bernstein 2014-08-23 14:08:56 +00:00
parent 7d5cc2444b
commit 81d38f9a90
1 changed files with 27 additions and 5 deletions

View File

@ -444,6 +444,10 @@ public class SortingResponseWriter implements QueryResponseWriter {
}
return docId+docBase < sd.docId+sd.docBase;
}
public String toString() {
return "";
}
}
class SingleValueSortDoc extends SortDoc {
@ -496,6 +500,10 @@ public class SortingResponseWriter implements QueryResponseWriter {
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 implements QueryResponseWriter {
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;
this.comp = comp;
this.currentOrd = comp.resetValue();
@ -1104,7 +1114,11 @@ public class SortingResponseWriter implements QueryResponseWriter {
if(ord < 0) {
currentOrd = -1;
} else {
if(globalOrds != null) {
currentOrd = (int)globalOrds.get(ord);
} else {
currentOrd = ord;
}
}
}
@ -1115,8 +1129,12 @@ public class SortingResponseWriter implements QueryResponseWriter {
public void setNextReader(AtomicReaderContext context) {
segment = context.ord;
if(ordinalMap != null) {
globalOrds = ordinalMap.getGlobalOrds(segment);
currentVals = segmentVals[segment];
} else {
currentVals = vals;
}
}
public void reset() {
@ -1127,6 +1145,10 @@ public class SortingResponseWriter implements QueryResponseWriter {
StringValue sv = (StringValue)o;
return comp.compare(currentOrd, sv.currentOrd);
}
public String toString() {
return Integer.toString(this.currentOrd);
}
}
protected abstract class FieldWriter {