mayya-sharipova commented on a change in pull request #11: URL: https://github.com/apache/lucene/pull/11#discussion_r598288400
########## File path: lucene/core/src/java/org/apache/lucene/index/FieldInfos.java ########## @@ -972,6 +671,64 @@ private boolean assertNotFinished() { return true; } + private FieldInfo addField( + String name, + int preferredFieldNumber, + boolean storeTermVector, + boolean omitNorms, + boolean storePayloads, + IndexOptions indexOptions, + DocValuesType docValues, + long dvGen, + Map<String, String> attributes, + int dataDimensionCount, + int indexDimensionCount, + int dimensionNumBytes, + int vectorDimension, + VectorValues.SearchStrategy vectorSearchStrategy, + boolean isSoftDeletesField) { + // This field wasn't yet added to this in-RAM + // segment's FieldInfo, so now we get a global + // number for this field. If the field was seen + // before then we'll get the same name and number, + // else we'll allocate a new one: + assert assertNotFinished(); + final int fieldNumber = + globalFieldNumbers.addOrGet( + name, + preferredFieldNumber, + indexOptions, + storeTermVector, + omitNorms, + docValues, + dataDimensionCount, + indexDimensionCount, + dimensionNumBytes, + vectorDimension, + vectorSearchStrategy, + isSoftDeletesField); + FieldInfo fi = + new FieldInfo( + name, + fieldNumber, + storeTermVector, + omitNorms, + storePayloads, + indexOptions, + docValues, + dvGen, + attributes, + dataDimensionCount, + indexDimensionCount, + dimensionNumBytes, + vectorDimension, + vectorSearchStrategy, + isSoftDeletesField); + assert byName.containsKey(fi.name) == false; Review comment: I've removed the assertion, as it is unnecessary. Before it this function we already checked that `byName` doesn't contain `fi.name`, and since `FieldInfos.Builder` is intended to be used in a single thread, this extra check or assertion is unnecessary. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org