mirror of https://github.com/apache/lucene.git
LUCENE-10603: Stop using SortedSetDocValues.NO_MORE_ORDS in tests (#1004)
This commit is contained in:
parent
da8143bfa3
commit
dd4e8b82d7
|
@ -104,8 +104,8 @@ Improvements
|
||||||
* LUCENE-10585: Facet module code cleanup (copy/paste scrubbing, simplification and some very minor
|
* LUCENE-10585: Facet module code cleanup (copy/paste scrubbing, simplification and some very minor
|
||||||
optimization tweaks). (Greg Miller)
|
optimization tweaks). (Greg Miller)
|
||||||
|
|
||||||
* LUCENE-10603: Update SortedSetDocValues iteration within production code to use
|
* LUCENE-10603: Update SortedSetDocValues iteration to use SortedSetDocValues#docValueCount().
|
||||||
SortedSetDocValues#docValueCount(). (Greg Miller)
|
(Greg Miller, Stefan Vodita)
|
||||||
|
|
||||||
* GITHUB#983: AbstractSortedSetDocValueFacetCounts internal code cleanup/refactoring. (Greg Miller)
|
* GITHUB#983: AbstractSortedSetDocValueFacetCounts internal code cleanup/refactoring. (Greg Miller)
|
||||||
|
|
||||||
|
|
|
@ -257,16 +257,12 @@ public abstract class BaseLucene80DocValuesFormatTestCase
|
||||||
assertTrue(valueSet.contains(sortedNumeric.nextValue()));
|
assertTrue(valueSet.contains(sortedNumeric.nextValue()));
|
||||||
}
|
}
|
||||||
assertEquals(i, sortedSet.nextDoc());
|
assertEquals(i, sortedSet.nextDoc());
|
||||||
int sortedSetCount = 0;
|
|
||||||
while (true) {
|
assertEquals(valueSet.size(), sortedSet.docValueCount());
|
||||||
|
for (int j = 0; j < sortedSet.docValueCount(); ++j) {
|
||||||
long ord = sortedSet.nextOrd();
|
long ord = sortedSet.nextOrd();
|
||||||
if (ord == SortedSetDocValues.NO_MORE_ORDS) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
assertTrue(valueSet.contains(Long.parseLong(sortedSet.lookupOrd(ord).utf8ToString())));
|
assertTrue(valueSet.contains(Long.parseLong(sortedSet.lookupOrd(ord).utf8ToString())));
|
||||||
sortedSetCount++;
|
|
||||||
}
|
}
|
||||||
assertEquals(valueSet.size(), sortedSetCount);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -480,6 +476,7 @@ public abstract class BaseLucene80DocValuesFormatTestCase
|
||||||
for (int i = 0; i < maxDoc; ++i) {
|
for (int i = 0; i < maxDoc; ++i) {
|
||||||
assertEquals(i, values.nextDoc());
|
assertEquals(i, values.nextDoc());
|
||||||
final int numValues = in.readVInt();
|
final int numValues = in.readVInt();
|
||||||
|
assertEquals(numValues, values.docValueCount());
|
||||||
|
|
||||||
for (int j = 0; j < numValues; ++j) {
|
for (int j = 0; j < numValues; ++j) {
|
||||||
b.setLength(in.readVInt());
|
b.setLength(in.readVInt());
|
||||||
|
|
|
@ -1205,6 +1205,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
||||||
assertEquals(id, dvShort.longValue());
|
assertEquals(id, dvShort.longValue());
|
||||||
|
|
||||||
assertEquals(i, dvSortedSet.nextDoc());
|
assertEquals(i, dvSortedSet.nextDoc());
|
||||||
|
assertEquals(1, dvSortedSet.docValueCount());
|
||||||
long ord = dvSortedSet.nextOrd();
|
long ord = dvSortedSet.nextOrd();
|
||||||
assertEquals(SortedSetDocValues.NO_MORE_ORDS, dvSortedSet.nextOrd());
|
assertEquals(SortedSetDocValues.NO_MORE_ORDS, dvSortedSet.nextOrd());
|
||||||
term = dvSortedSet.lookupOrd(ord);
|
term = dvSortedSet.lookupOrd(ord);
|
||||||
|
|
|
@ -265,17 +265,12 @@ public class TestLucene90DocValuesFormat extends BaseCompressingDocValuesFormatT
|
||||||
assertTrue(valueSet.contains(sortedNumeric.nextValue()));
|
assertTrue(valueSet.contains(sortedNumeric.nextValue()));
|
||||||
}
|
}
|
||||||
assertEquals(i, sortedSet.nextDoc());
|
assertEquals(i, sortedSet.nextDoc());
|
||||||
|
|
||||||
assertEquals(valueSet.size(), sortedSet.docValueCount());
|
assertEquals(valueSet.size(), sortedSet.docValueCount());
|
||||||
int sortedSetCount = 0;
|
for (int j = 0; j < sortedSet.docValueCount(); ++j) {
|
||||||
while (true) {
|
|
||||||
long ord = sortedSet.nextOrd();
|
long ord = sortedSet.nextOrd();
|
||||||
if (ord == SortedSetDocValues.NO_MORE_ORDS) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
assertTrue(valueSet.contains(Long.parseLong(sortedSet.lookupOrd(ord).utf8ToString())));
|
assertTrue(valueSet.contains(Long.parseLong(sortedSet.lookupOrd(ord).utf8ToString())));
|
||||||
sortedSetCount++;
|
|
||||||
}
|
}
|
||||||
assertEquals(valueSet.size(), sortedSetCount);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,12 +369,14 @@ public class TestBinaryDocValuesUpdates extends LuceneTestCase {
|
||||||
assertEquals(i, Integer.parseInt(term.utf8ToString()));
|
assertEquals(i, Integer.parseInt(term.utf8ToString()));
|
||||||
// For the i=0 case, we added the same value twice, which was dedup'd by IndexWriter so it has
|
// For the i=0 case, we added the same value twice, which was dedup'd by IndexWriter so it has
|
||||||
// only one value:
|
// only one value:
|
||||||
if (i != 0) {
|
if (i == 0) {
|
||||||
|
assertEquals(1, ssdv.docValueCount());
|
||||||
|
} else {
|
||||||
|
assertEquals(2, ssdv.docValueCount());
|
||||||
ord = ssdv.nextOrd();
|
ord = ssdv.nextOrd();
|
||||||
term = ssdv.lookupOrd(ord);
|
term = ssdv.lookupOrd(ord);
|
||||||
assertEquals(i * 2, Integer.parseInt(term.utf8ToString()));
|
assertEquals(i * 2, Integer.parseInt(term.utf8ToString()));
|
||||||
}
|
}
|
||||||
assertEquals(SortedSetDocValues.NO_MORE_ORDS, ssdv.nextOrd());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.close();
|
reader.close();
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.lucene.index;
|
||||||
import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
|
import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import org.apache.lucene.document.BinaryDocValuesField;
|
import org.apache.lucene.document.BinaryDocValuesField;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
|
@ -279,20 +278,11 @@ public class TestMultiDocValues extends LuceneTestCase {
|
||||||
if (docID == NO_MORE_DOCS) {
|
if (docID == NO_MORE_DOCS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(single.docValueCount(), multi.docValueCount());
|
assertEquals(single.docValueCount(), multi.docValueCount());
|
||||||
|
for (int i = 0; i < single.docValueCount(); i++) {
|
||||||
ArrayList<Long> expectedList = new ArrayList<>();
|
assertEquals(single.nextOrd(), multi.nextOrd());
|
||||||
long ord;
|
|
||||||
while ((ord = single.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
|
|
||||||
expectedList.add(ord);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int upto = 0;
|
|
||||||
while ((ord = multi.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
|
|
||||||
assertEquals(expectedList.get(upto).longValue(), ord);
|
|
||||||
upto++;
|
|
||||||
}
|
|
||||||
assertEquals(expectedList.size(), upto);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
testRandomAdvance(
|
testRandomAdvance(
|
||||||
|
@ -354,18 +344,11 @@ public class TestMultiDocValues extends LuceneTestCase {
|
||||||
if (docID == NO_MORE_DOCS) {
|
if (docID == NO_MORE_DOCS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ArrayList<Long> expectedList = new ArrayList<>();
|
|
||||||
long ord;
|
|
||||||
while ((ord = single.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
|
|
||||||
expectedList.add(ord);
|
|
||||||
}
|
|
||||||
|
|
||||||
int upto = 0;
|
assertEquals(single.docValueCount(), multi.docValueCount());
|
||||||
while ((ord = multi.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
|
for (int i = 0; i < single.docValueCount(); i++) {
|
||||||
assertEquals(expectedList.get(upto).longValue(), ord);
|
assertEquals(single.nextOrd(), multi.nextOrd());
|
||||||
upto++;
|
|
||||||
}
|
}
|
||||||
assertEquals(expectedList.size(), upto);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
testRandomAdvance(
|
testRandomAdvance(
|
||||||
|
|
|
@ -459,12 +459,14 @@ public class TestNumericDocValuesUpdates extends LuceneTestCase {
|
||||||
long ord = ssdv.nextOrd();
|
long ord = ssdv.nextOrd();
|
||||||
term = ssdv.lookupOrd(ord);
|
term = ssdv.lookupOrd(ord);
|
||||||
assertEquals(i, Integer.parseInt(term.utf8ToString()));
|
assertEquals(i, Integer.parseInt(term.utf8ToString()));
|
||||||
if (i != 0) {
|
if (i == 0) {
|
||||||
|
assertEquals(1, ssdv.docValueCount());
|
||||||
|
} else {
|
||||||
|
assertEquals(2, ssdv.docValueCount());
|
||||||
ord = ssdv.nextOrd();
|
ord = ssdv.nextOrd();
|
||||||
term = ssdv.lookupOrd(ord);
|
term = ssdv.lookupOrd(ord);
|
||||||
assertEquals(i * 2, Integer.parseInt(term.utf8ToString()));
|
assertEquals(i * 2, Integer.parseInt(term.utf8ToString()));
|
||||||
}
|
}
|
||||||
assertEquals(SortedSetDocValues.NO_MORE_ORDS, ssdv.nextOrd());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.close();
|
reader.close();
|
||||||
|
|
|
@ -409,7 +409,8 @@ public class TestMinShouldMatch2 extends LuceneTestCase {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
long ord;
|
long ord;
|
||||||
while ((ord = dv.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
|
for (int i = 0; i < dv.docValueCount(); i++) {
|
||||||
|
ord = dv.nextOrd();
|
||||||
if (ords.contains(ord)) {
|
if (ords.contains(ord)) {
|
||||||
currentMatched++;
|
currentMatched++;
|
||||||
score += sims[(int) ord].score(currentDoc, 1);
|
score += sims[(int) ord].score(currentDoc, 1);
|
||||||
|
|
|
@ -1760,7 +1760,8 @@ public class TestJoinUtil extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
if (doc == docTermOrds.docID()) {
|
if (doc == docTermOrds.docID()) {
|
||||||
long ord;
|
long ord;
|
||||||
while ((ord = docTermOrds.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
|
for (int j = 0; j < docTermOrds.docValueCount(); j++) {
|
||||||
|
ord = docTermOrds.nextOrd();
|
||||||
final BytesRef joinValue = docTermOrds.lookupOrd(ord);
|
final BytesRef joinValue = docTermOrds.lookupOrd(ord);
|
||||||
JoinScore joinScore = joinValueToJoinScores.get(joinValue);
|
JoinScore joinScore = joinValueToJoinScores.get(joinValue);
|
||||||
if (joinScore == null) {
|
if (joinScore == null) {
|
||||||
|
|
|
@ -329,6 +329,7 @@ public class TestMemoryIndex extends LuceneTestCase {
|
||||||
assertEquals(3, sortedSetDocValues.getValueCount());
|
assertEquals(3, sortedSetDocValues.getValueCount());
|
||||||
for (int times = 0; times < 3; times++) {
|
for (int times = 0; times < 3; times++) {
|
||||||
assertTrue(sortedSetDocValues.advanceExact(0));
|
assertTrue(sortedSetDocValues.advanceExact(0));
|
||||||
|
assertEquals(3, sortedSetDocValues.docValueCount());
|
||||||
assertEquals(0L, sortedSetDocValues.nextOrd());
|
assertEquals(0L, sortedSetDocValues.nextOrd());
|
||||||
assertEquals(1L, sortedSetDocValues.nextOrd());
|
assertEquals(1L, sortedSetDocValues.nextOrd());
|
||||||
assertEquals(2L, sortedSetDocValues.nextOrd());
|
assertEquals(2L, sortedSetDocValues.nextOrd());
|
||||||
|
|
|
@ -533,14 +533,14 @@ public class TestMemoryIndexAgainstDirectory extends BaseTokenStreamTestCase {
|
||||||
controlLeafReader.getSortedSetDocValues("sorted_set");
|
controlLeafReader.getSortedSetDocValues("sorted_set");
|
||||||
assertEquals(0, controlSortedSetDocValues.nextDoc());
|
assertEquals(0, controlSortedSetDocValues.nextDoc());
|
||||||
assertEquals(controlSortedSetDocValues.getValueCount(), sortedSetDocValues.getValueCount());
|
assertEquals(controlSortedSetDocValues.getValueCount(), sortedSetDocValues.getValueCount());
|
||||||
for (long controlOrd = controlSortedSetDocValues.nextOrd();
|
for (int i = 0; i < controlSortedSetDocValues.docValueCount(); i++) {
|
||||||
controlOrd != SortedSetDocValues.NO_MORE_ORDS;
|
long controlOrd = controlSortedSetDocValues.nextOrd();
|
||||||
controlOrd = controlSortedSetDocValues.nextOrd()) {
|
|
||||||
assertEquals(controlOrd, sortedSetDocValues.nextOrd());
|
assertEquals(controlOrd, sortedSetDocValues.nextOrd());
|
||||||
assertEquals(
|
assertEquals(
|
||||||
controlSortedSetDocValues.lookupOrd(controlOrd),
|
controlSortedSetDocValues.lookupOrd(controlOrd),
|
||||||
sortedSetDocValues.lookupOrd(controlOrd));
|
sortedSetDocValues.lookupOrd(controlOrd));
|
||||||
}
|
}
|
||||||
|
assertEquals(SortedSetDocValues.NO_MORE_ORDS, controlSortedSetDocValues.nextOrd());
|
||||||
assertEquals(SortedSetDocValues.NO_MORE_ORDS, sortedSetDocValues.nextOrd());
|
assertEquals(SortedSetDocValues.NO_MORE_ORDS, sortedSetDocValues.nextOrd());
|
||||||
|
|
||||||
indexReader.close();
|
indexReader.close();
|
||||||
|
|
|
@ -1809,6 +1809,8 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
|
|
||||||
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
||||||
assertEquals(0, dv.nextDoc());
|
assertEquals(0, dv.nextDoc());
|
||||||
|
|
||||||
|
assertEquals(1, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
|
@ -1834,6 +1836,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
||||||
assertEquals(0, dv.nextDoc());
|
assertEquals(0, dv.nextDoc());
|
||||||
|
|
||||||
|
assertEquals(1, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
|
@ -1841,8 +1844,9 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
assertEquals(newBytesRef("hello"), bytes);
|
assertEquals(newBytesRef("hello"), bytes);
|
||||||
|
|
||||||
dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field2");
|
dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field2");
|
||||||
|
|
||||||
assertEquals(0, dv.nextDoc());
|
assertEquals(0, dv.nextDoc());
|
||||||
|
|
||||||
|
assertEquals(1, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
|
@ -1877,6 +1881,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
assertEquals(2, dv.getValueCount());
|
assertEquals(2, dv.getValueCount());
|
||||||
|
|
||||||
assertEquals(0, dv.nextDoc());
|
assertEquals(0, dv.nextDoc());
|
||||||
|
assertEquals(1, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
|
@ -1884,6 +1889,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
assertEquals(newBytesRef("hello"), bytes);
|
assertEquals(newBytesRef("hello"), bytes);
|
||||||
|
|
||||||
assertEquals(1, dv.nextDoc());
|
assertEquals(1, dv.nextDoc());
|
||||||
|
assertEquals(1, dv.docValueCount());
|
||||||
assertEquals(1, dv.nextOrd());
|
assertEquals(1, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
|
@ -1909,6 +1915,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
||||||
assertEquals(0, dv.nextDoc());
|
assertEquals(0, dv.nextDoc());
|
||||||
|
|
||||||
|
assertEquals(2, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(1, dv.nextOrd());
|
assertEquals(1, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
@ -1938,6 +1945,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
||||||
assertEquals(0, dv.nextDoc());
|
assertEquals(0, dv.nextDoc());
|
||||||
|
|
||||||
|
assertEquals(2, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(1, dv.nextOrd());
|
assertEquals(1, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
@ -1978,11 +1986,13 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
assertEquals(3, dv.getValueCount());
|
assertEquals(3, dv.getValueCount());
|
||||||
|
|
||||||
assertEquals(0, dv.nextDoc());
|
assertEquals(0, dv.nextDoc());
|
||||||
|
assertEquals(2, dv.docValueCount());
|
||||||
assertEquals(1, dv.nextOrd());
|
assertEquals(1, dv.nextOrd());
|
||||||
assertEquals(2, dv.nextOrd());
|
assertEquals(2, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
assertEquals(1, dv.nextDoc());
|
assertEquals(1, dv.nextDoc());
|
||||||
|
assertEquals(2, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(1, dv.nextOrd());
|
assertEquals(1, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
@ -2019,8 +2029,9 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
|
|
||||||
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
||||||
assertEquals(1, dv.getValueCount());
|
assertEquals(1, dv.getValueCount());
|
||||||
|
|
||||||
assertEquals(0, dv.nextDoc());
|
assertEquals(0, dv.nextDoc());
|
||||||
|
|
||||||
|
assertEquals(1, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
|
@ -2052,8 +2063,9 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
|
|
||||||
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
||||||
assertEquals(1, dv.getValueCount());
|
assertEquals(1, dv.getValueCount());
|
||||||
|
|
||||||
assertEquals(0, dv.nextDoc());
|
assertEquals(0, dv.nextDoc());
|
||||||
|
|
||||||
|
assertEquals(1, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
|
@ -2084,8 +2096,9 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
|
|
||||||
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
||||||
assertEquals(1, dv.getValueCount());
|
assertEquals(1, dv.getValueCount());
|
||||||
|
|
||||||
assertEquals(1, dv.nextDoc());
|
assertEquals(1, dv.nextDoc());
|
||||||
|
|
||||||
|
assertEquals(1, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
|
@ -2117,8 +2130,9 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
|
|
||||||
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
SortedSetDocValues dv = getOnlyLeafReader(ireader).getSortedSetDocValues("field");
|
||||||
assertEquals(1, dv.getValueCount());
|
assertEquals(1, dv.getValueCount());
|
||||||
|
|
||||||
assertEquals(1, dv.nextDoc());
|
assertEquals(1, dv.nextDoc());
|
||||||
|
|
||||||
|
assertEquals(1, dv.docValueCount());
|
||||||
assertEquals(0, dv.nextOrd());
|
assertEquals(0, dv.nextOrd());
|
||||||
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
assertEquals(NO_MORE_ORDS, dv.nextOrd());
|
||||||
|
|
||||||
|
@ -2320,12 +2334,12 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
}
|
}
|
||||||
if (docValues != null && stringValues.length > 0) {
|
if (docValues != null && stringValues.length > 0) {
|
||||||
assertEquals(i, docValues.docID());
|
assertEquals(i, docValues.docID());
|
||||||
for (int j = 0; j < stringValues.length; j++) {
|
assertEquals(stringValues.length, docValues.docValueCount());
|
||||||
|
for (String stringValue : stringValues) {
|
||||||
assert docValues != null;
|
assert docValues != null;
|
||||||
long ord = docValues.nextOrd();
|
long ord = docValues.nextOrd();
|
||||||
assert ord != NO_MORE_ORDS;
|
|
||||||
BytesRef scratch = docValues.lookupOrd(ord);
|
BytesRef scratch = docValues.lookupOrd(ord);
|
||||||
assertEquals(stringValues[j], scratch.utf8ToString());
|
assertEquals(stringValue, scratch.utf8ToString());
|
||||||
}
|
}
|
||||||
assertEquals(NO_MORE_ORDS, docValues.nextOrd());
|
assertEquals(NO_MORE_ORDS, docValues.nextOrd());
|
||||||
}
|
}
|
||||||
|
@ -2353,12 +2367,12 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
}
|
}
|
||||||
if (stringValues.length > 0) {
|
if (stringValues.length > 0) {
|
||||||
assertEquals(i, docValues.docID());
|
assertEquals(i, docValues.docID());
|
||||||
for (int j = 0; j < stringValues.length; j++) {
|
assertEquals(stringValues.length, docValues.docValueCount());
|
||||||
|
for (String stringValue : stringValues) {
|
||||||
assert docValues != null;
|
assert docValues != null;
|
||||||
long ord = docValues.nextOrd();
|
long ord = docValues.nextOrd();
|
||||||
assert ord != NO_MORE_ORDS;
|
|
||||||
BytesRef scratch = docValues.lookupOrd(ord);
|
BytesRef scratch = docValues.lookupOrd(ord);
|
||||||
assertEquals(stringValues[j], scratch.utf8ToString());
|
assertEquals(stringValue, scratch.utf8ToString());
|
||||||
}
|
}
|
||||||
assertEquals(NO_MORE_ORDS, docValues.nextOrd());
|
assertEquals(NO_MORE_ORDS, docValues.nextOrd());
|
||||||
}
|
}
|
||||||
|
@ -2891,13 +2905,13 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
|
||||||
if (values.length > 0) {
|
if (values.length > 0) {
|
||||||
assertNotNull(sortedSet);
|
assertNotNull(sortedSet);
|
||||||
assertEquals(j, sortedSet.nextDoc());
|
assertEquals(j, sortedSet.nextDoc());
|
||||||
for (int k = 0; k < values.length; k++) {
|
assertEquals(values.length, sortedSet.docValueCount());
|
||||||
|
for (String s : values) {
|
||||||
long ord = sortedSet.nextOrd();
|
long ord = sortedSet.nextOrd();
|
||||||
assertTrue(ord != SortedSetDocValues.NO_MORE_ORDS);
|
|
||||||
BytesRef value = sortedSet.lookupOrd(ord);
|
BytesRef value = sortedSet.lookupOrd(ord);
|
||||||
assertEquals(values[k], value.utf8ToString());
|
assertEquals(s, value.utf8ToString());
|
||||||
}
|
}
|
||||||
assertEquals(SortedSetDocValues.NO_MORE_ORDS, sortedSet.nextOrd());
|
assertEquals(NO_MORE_ORDS, sortedSet.nextOrd());
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] numValues = r.document(j).getValues("storedSortedNumeric");
|
String[] numValues = r.document(j).getValues("storedSortedNumeric");
|
||||||
|
|
|
@ -2586,11 +2586,10 @@ public abstract class LuceneTestCase extends Assert {
|
||||||
if (docID == NO_MORE_DOCS) {
|
if (docID == NO_MORE_DOCS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
long ord;
|
assertEquals(info, leftValues.docValueCount(), rightValues.docValueCount());
|
||||||
while ((ord = leftValues.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
|
for (int i = 0; i < leftValues.docValueCount(); i++) {
|
||||||
assertEquals(info, ord, rightValues.nextOrd());
|
assertEquals(info, leftValues.nextOrd(), rightValues.nextOrd());
|
||||||
}
|
}
|
||||||
assertEquals(info, SortedSetDocValues.NO_MORE_ORDS, rightValues.nextOrd());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assertNull(info, leftValues);
|
assertNull(info, leftValues);
|
||||||
|
|
Loading…
Reference in New Issue