You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Yauheni Putsykovich (Jira)" <ji...@apache.org> on 2020/07/22 15:20:00 UTC
[jira] [Created] (LUCENE-9440) FieldInfo#checkConsistency called
twice from Lucene50FieldInfosFormat#read
Yauheni Putsykovich created LUCENE-9440:
-------------------------------------------
Summary: FieldInfo#checkConsistency called twice from Lucene50FieldInfosFormat#read
Key: LUCENE-9440
URL: https://issues.apache.org/jira/browse/LUCENE-9440
Project: Lucene - Core
Issue Type: Improvement
Components: core/index
Affects Versions: master (9.0)
Reporter: Yauheni Putsykovich
Reviewing code I noticed that we do call _infos[i].checkConsistency();_ method twice: first time inside the _FiledInfo_'s constructor and a second one just after we've created an object.
org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java:150
{code:java}
infos[i] = new FieldInfo(name, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValuesType, dvGen, attributes, 0, 0, 0, false); infos[i].checkConsistency();
{code}
_FileInfo_'s constructor(notice the last line)
{code:java}
public FieldInfo(String name, int number, boolean storeTermVector, boolean omitNorms, boolean storePayloads,
IndexOptions indexOptions, DocValuesType docValues, long dvGen, Map<String,String> attributes,
int pointDimensionCount, int pointIndexDimensionCount, int pointNumBytes, boolean softDeletesField) {
this.name = Objects.requireNonNull(name);
this.number = number;
this.docValuesType = Objects.requireNonNull(docValues, "DocValuesType must not be null (field: \"" + name + "\")");
this.indexOptions = Objects.requireNonNull(indexOptions, "IndexOptions must not be null (field: \"" + name + "\")");
if (indexOptions != IndexOptions.NONE) {
this.storeTermVector = storeTermVector;
this.storePayloads = storePayloads;
this.omitNorms = omitNorms;
} else { // for non-indexed fields, leave defaults
this.storeTermVector = false;
this.storePayloads = false;
this.omitNorms = false;
}
this.dvGen = dvGen;
this.attributes = Objects.requireNonNull(attributes);
this.pointDimensionCount = pointDimensionCount;
this.pointIndexDimensionCount = pointIndexDimensionCount;
this.pointNumBytes = pointNumBytes;
this.softDeletesField = softDeletesField;
assert checkConsistency();
}
{code}
By this patch, I will remove the second call and leave only one in the constructor.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org