mayya-sharipova commented on a change in pull request #2186: URL: https://github.com/apache/lucene-solr/pull/2186#discussion_r595557219
########## File path: lucene/core/src/java/org/apache/lucene/index/FieldInfo.java ########## @@ -130,127 +167,252 @@ public boolean checkConsistency() { } } - if (pointDimensionCount < 0) { + if (docValuesType == null) { + throw new IllegalStateException("DocValuesType must not be null (field: '" + name + "')"); + } + if (dvGen != -1 && docValuesType == DocValuesType.NONE) { throw new IllegalStateException( - "pointDimensionCount must be >= 0; got " + pointDimensionCount); + "field '" + + name + + "' cannot have a docvalues update generation without having docvalues"); } + if (pointDimensionCount < 0) { + throw new IllegalStateException( + "pointDimensionCount must be >= 0; got " + + pointDimensionCount + + " (field: '" + + name + + "')"); + } if (pointIndexDimensionCount < 0) { throw new IllegalStateException( - "pointIndexDimensionCount must be >= 0; got " + pointIndexDimensionCount); + "pointIndexDimensionCount must be >= 0; got " + + pointIndexDimensionCount + + " (field: '" + + name + + "')"); } - if (pointNumBytes < 0) { - throw new IllegalStateException("pointNumBytes must be >= 0; got " + pointNumBytes); + throw new IllegalStateException( + "pointNumBytes must be >= 0; got " + pointNumBytes + " (field: '" + name + "')"); } if (pointDimensionCount != 0 && pointNumBytes == 0) { throw new IllegalStateException( - "pointNumBytes must be > 0 when pointDimensionCount=" + pointDimensionCount); + "pointNumBytes must be > 0 when pointDimensionCount=" + + pointDimensionCount + + " (field: '" + + name + + "')"); } - if (pointIndexDimensionCount != 0 && pointDimensionCount == 0) { throw new IllegalStateException( - "pointIndexDimensionCount must be 0 when pointDimensionCount=0"); + "pointIndexDimensionCount must be 0 when pointDimensionCount=0" + + " (field: '" + + name + + "')"); } - if (pointNumBytes != 0 && pointDimensionCount == 0) { throw new IllegalStateException( - "pointDimensionCount must be > 0 when pointNumBytes=" + pointNumBytes); + "pointDimensionCount must be > 0 when pointNumBytes=" + + pointNumBytes + + " (field: '" + + name + + "')"); } - if (dvGen != -1 && docValuesType == DocValuesType.NONE) { + if (vectorSearchStrategy == null) { throw new IllegalStateException( - "field '" - + name - + "' cannot have a docvalues update generation without having docvalues"); + "Vector search strategy must not be null (field: '" + name + "')"); } - if (vectorDimension < 0) { - throw new IllegalStateException("vectorDimension must be >=0; got " + vectorDimension); + throw new IllegalStateException( + "vectorDimension must be >=0; got " + vectorDimension + " (field: '" + name + "')"); } - if (vectorDimension == 0 && vectorSearchStrategy != VectorValues.SearchStrategy.NONE) { throw new IllegalStateException( - "vector search strategy must be NONE when dimension = 0; got " + vectorSearchStrategy); + "vector search strategy must be NONE when dimension = 0; got " + + vectorSearchStrategy + + " (field: '" + + name + + "')"); } - return true; } - // should only be called by FieldInfos#addOrUpdate - void update( - boolean storeTermVector, - boolean omitNorms, - boolean storePayloads, - IndexOptions indexOptions, - Map<String, String> attributes, - int dimensionCount, - int indexDimensionCount, - int dimensionNumBytes) { - if (indexOptions == null) { - throw new NullPointerException("IndexOptions must not be null (field: \"" + name + "\")"); - } - // System.out.println("FI.update field=" + name + " indexed=" + indexed + " omitNorms=" + - // omitNorms + " this.omitNorms=" + this.omitNorms); - if (this.indexOptions != indexOptions) { - if (this.indexOptions == IndexOptions.NONE) { - this.indexOptions = indexOptions; - } else if (indexOptions != IndexOptions.NONE) { - throw new IllegalArgumentException( - "cannot change field \"" - + name - + "\" from index options=" - + this.indexOptions - + " to inconsistent index options=" - + indexOptions); - } + void verifySameSchema(FieldInfo o, long dvGen) { Review comment: addressed [here](https://github.com/apache/lucene/pull/11/commits/0fe3493110ac2a5f750ad41f732436daff6c69f5#diff-b9ceb6f65b3597b6c2406c2d41cc7db39e04e21bb77a13fcc92eb0429c444d46L244) ---------------------------------------------------------------- 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