don't try to remap empty ord in slow-wrapper

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1516454 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-08-22 14:09:36 +00:00
parent 3902a2f379
commit fb9bb2d437
2 changed files with 5 additions and 2 deletions

View File

@ -450,7 +450,7 @@ public class MultiDocValues {
public int getOrd(int docID) { public int getOrd(int docID) {
int subIndex = ReaderUtil.subIndex(docID, docStarts); int subIndex = ReaderUtil.subIndex(docID, docStarts);
int segmentOrd = values[subIndex].getOrd(docID - docStarts[subIndex]); int segmentOrd = values[subIndex].getOrd(docID - docStarts[subIndex]);
return (int) mapping.getGlobalOrd(subIndex, segmentOrd); return segmentOrd == -1 ? segmentOrd : (int) mapping.getGlobalOrd(subIndex, segmentOrd);
} }
@Override @Override

View File

@ -121,6 +121,9 @@ public class TestMultiDocValues extends LuceneTestCase {
int numDocs = atLeast(500); int numDocs = atLeast(500);
for (int i = 0; i < numDocs; i++) { for (int i = 0; i < numDocs; i++) {
ref.copyChars(_TestUtil.randomUnicodeString(random())); ref.copyChars(_TestUtil.randomUnicodeString(random()));
if (random().nextInt(7) == 0) {
iw.addDocument(new Document());
}
iw.addDocument(doc); iw.addDocument(doc);
if (random().nextInt(17) == 0) { if (random().nextInt(17) == 0) {
iw.commit(); iw.commit();
@ -140,7 +143,7 @@ public class TestMultiDocValues extends LuceneTestCase {
for (int i = 0; i < numDocs; i++) { for (int i = 0; i < numDocs; i++) {
// check ord // check ord
assertEquals(single.getOrd(i), multi.getOrd(i)); assertEquals(single.getOrd(i), multi.getOrd(i));
// check ord value // check value
single.get(i, expected); single.get(i, expected);
multi.get(i, actual); multi.get(i, actual);
assertEquals(expected, actual); assertEquals(expected, actual);