assertEquals(info, leftFields, rightFields);
for (String field : leftFields) {
// TODO: clean this up... very messy
{
NumericDocValues leftValues = MultiDocValues.getNumericValues(leftReader, field);
NumericDocValues rightValues = MultiDocValues.getNumericValues(rightReader, field);
if (leftValues != null && rightValues != null) {
assertDocValuesEquals(info, leftReader.maxDoc(), leftValues, rightValues);
} else {
assertNull(info, leftValues);
assertNull(info, rightValues);
}
}
{
BinaryDocValues leftValues = MultiDocValues.getBinaryValues(leftReader, field);
BinaryDocValues rightValues = MultiDocValues.getBinaryValues(rightReader, field);
if (leftValues != null && rightValues != null) {
for(int docID=0;docID<leftReader.maxDoc();docID++) {
final BytesRef left = BytesRef.deepCopyOf(leftValues.get(docID));
final BytesRef right = rightValues.get(docID);
assertEquals(info, left, right);
}
} else {
assertNull(info, leftValues);
assertNull(info, rightValues);
}
}
{
SortedDocValues leftValues = MultiDocValues.getSortedValues(leftReader, field);
SortedDocValues rightValues = MultiDocValues.getSortedValues(rightReader, field);
if (leftValues != null && rightValues != null) {
// numOrds
assertEquals(info, leftValues.getValueCount(), rightValues.getValueCount());
// ords
BytesRef scratchLeft = new BytesRef();
BytesRef scratchRight = new BytesRef();
for (int i = 0; i < leftValues.getValueCount(); i++) {
final BytesRef left = BytesRef.deepCopyOf(leftValues.lookupOrd(i));
final BytesRef right = rightValues.lookupOrd(i);
assertEquals(info, left, right);
}
// bytes
for(int docID=0;docID<leftReader.maxDoc();docID++) {
final BytesRef left = BytesRef.deepCopyOf(leftValues.get(docID));
final BytesRef right = rightValues.get(docID);
assertEquals(info, left, right);
}
} else {
assertNull(info, leftValues);
assertNull(info, rightValues);
}
}
{
SortedSetDocValues leftValues = MultiDocValues.getSortedSetValues(leftReader, field);
SortedSetDocValues rightValues = MultiDocValues.getSortedSetValues(rightReader, field);
if (leftValues != null && rightValues != null) {
// numOrds
assertEquals(info, leftValues.getValueCount(), rightValues.getValueCount());
// ords
for (int i = 0; i < leftValues.getValueCount(); i++) {
final BytesRef left = BytesRef.deepCopyOf(leftValues.lookupOrd(i));
final BytesRef right = rightValues.lookupOrd(i);
assertEquals(info, left, right);
}
// ord lists
for(int docID=0;docID<leftReader.maxDoc();docID++) {
leftValues.setDocument(docID);
rightValues.setDocument(docID);
long ord;
while ((ord = leftValues.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
assertEquals(info, ord, rightValues.nextOrd());
}
assertEquals(info, SortedSetDocValues.NO_MORE_ORDS, rightValues.nextOrd());
}
} else {
assertNull(info, leftValues);
assertNull(info, rightValues);
}
}
{
SortedNumericDocValues leftValues = MultiDocValues.getSortedNumericValues(leftReader, field);
SortedNumericDocValues rightValues = MultiDocValues.getSortedNumericValues(rightReader, field);
if (leftValues != null && rightValues != null) {
for (int i = 0; i < leftReader.maxDoc(); i++) {
leftValues.setDocument(i);
long expected[] = new long[leftValues.count()];
for (int j = 0; j < expected.length; j++) {
expected[j] = leftValues.valueAt(j);
}
rightValues.setDocument(i);
for (int j = 0; j < expected.length; j++) {
assertEquals(info, expected[j], rightValues.valueAt(j));
}
assertEquals(info, expected.length, rightValues.count());
}
} else {
assertNull(info, leftValues);
assertNull(info, rightValues);
}