mirror of https://github.com/apache/lucene.git
LUCENE-10182: No longer check dvGen. (#350)
`dvGen` doesn't need to be checked for schema consistency since it is always -1. Furthermore, this change changes the `assertSame` that takes an object to make it take an enum instead, since it uses instance equality checks which are generally incorrect for objects.
This commit is contained in:
parent
674b66dd16
commit
feac4cd09e
|
@ -676,7 +676,7 @@ final class IndexingChain implements Accountable {
|
|||
false,
|
||||
s.indexOptions,
|
||||
s.docValuesType,
|
||||
s.dvGen,
|
||||
-1,
|
||||
s.attributes,
|
||||
s.pointDimensionCount,
|
||||
s.pointIndexDimensionCount,
|
||||
|
@ -816,7 +816,7 @@ final class IndexingChain implements Accountable {
|
|||
verifyUnIndexedFieldType(fieldName, fieldType);
|
||||
}
|
||||
if (fieldType.docValuesType() != DocValuesType.NONE) {
|
||||
schema.setDocValues(fieldType.docValuesType(), -1);
|
||||
schema.setDocValues(fieldType.docValuesType());
|
||||
}
|
||||
if (fieldType.pointDimensionCount() != 0) {
|
||||
schema.setPoints(
|
||||
|
@ -1321,7 +1321,6 @@ final class IndexingChain implements Accountable {
|
|||
private boolean omitNorms = false;
|
||||
private boolean storeTermVector = false;
|
||||
private IndexOptions indexOptions = IndexOptions.NONE;
|
||||
private long dvGen = -1;
|
||||
private DocValuesType docValuesType = DocValuesType.NONE;
|
||||
private int pointDimensionCount = 0;
|
||||
private int pointIndexDimensionCount = 0;
|
||||
|
@ -1348,7 +1347,7 @@ final class IndexingChain implements Accountable {
|
|||
}
|
||||
}
|
||||
|
||||
private void assertSame(String label, Object expected, Object given) {
|
||||
private <T extends Enum<?>> void assertSame(String label, T expected, T given) {
|
||||
if (expected != given) {
|
||||
raiseNotSame(label, expected, given);
|
||||
}
|
||||
|
@ -1387,13 +1386,11 @@ final class IndexingChain implements Accountable {
|
|||
}
|
||||
}
|
||||
|
||||
void setDocValues(DocValuesType newDocValuesType, long newDvGen) {
|
||||
void setDocValues(DocValuesType newDocValuesType) {
|
||||
if (docValuesType == DocValuesType.NONE) {
|
||||
this.docValuesType = newDocValuesType;
|
||||
this.dvGen = newDvGen;
|
||||
} else {
|
||||
assertSame("doc values type", docValuesType, newDocValuesType);
|
||||
assertSame("doc values generation", dvGen, newDvGen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1424,7 +1421,6 @@ final class IndexingChain implements Accountable {
|
|||
omitNorms = false;
|
||||
storeTermVector = false;
|
||||
indexOptions = IndexOptions.NONE;
|
||||
dvGen = -1;
|
||||
docValuesType = DocValuesType.NONE;
|
||||
pointDimensionCount = 0;
|
||||
pointIndexDimensionCount = 0;
|
||||
|
@ -1438,7 +1434,6 @@ final class IndexingChain implements Accountable {
|
|||
assertSame("omit norms", fi.omitsNorms(), omitNorms);
|
||||
assertSame("store term vector", fi.hasVectors(), storeTermVector);
|
||||
assertSame("doc values type", fi.getDocValuesType(), docValuesType);
|
||||
assertSame("doc values generation", fi.getDocValuesGen(), dvGen);
|
||||
assertSame(
|
||||
"vector similarity function", fi.getVectorSimilarityFunction(), vectorSimilarityFunction);
|
||||
assertSame("vector dimension", fi.getVectorDimension(), vectorDimension);
|
||||
|
|
Loading…
Reference in New Issue