Fix test that modifies schema (#87)

LUCENE-9334 requires that docs have the same schema
across the whole schema.
This fixes the test that attempts to modify schema of "number" field
from DocValues and Points to just DocValues.

Relates to #11
This commit is contained in:
Mayya Sharipova 2021-04-15 17:48:49 -04:00 committed by GitHub
parent 9a346e3739
commit 49c7cc1197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -987,7 +987,6 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
w.addDocument(newDoc);
}
} else {
// Just carry over doc values from previous field:
NumericDocValues oldValues = reader.getNumericDocValues("number");
assertNotNull("oldSchemaGen=" + oldSchemaGen, oldValues);
for (int i = 0; i < maxDoc; i++) {
@ -995,9 +994,9 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
reader.document(i);
Document newDoc = new Document();
assertEquals(i, oldValues.nextDoc());
newDoc.add(
new NumericDocValuesField(
"number", newSchemaGen * (oldValues.longValue() / oldSchemaGen)));
long value = newSchemaGen * (oldValues.longValue() / oldSchemaGen);
newDoc.add(new NumericDocValuesField("number", value));
newDoc.add(new LongPoint("number", value));
w.addDocument(newDoc);
}
}