msokolov commented on a change in pull request #1930: URL: https://github.com/apache/lucene-solr/pull/1930#discussion_r499862666
########## File path: lucene/core/src/java/org/apache/lucene/document/FieldType.java ########## @@ -351,6 +356,27 @@ public int pointNumBytes() { return dimensionNumBytes; } + void setVectorDimensionsAndScoreFunction(int numDimensions, VectorValues.ScoreFunction distFunc) { + if (numDimensions <= 0) { + throw new IllegalArgumentException("vector numDimensions must be > 0; got " + numDimensions); + } + if (numDimensions > VectorValues.MAX_DIMENSIONS) { + throw new IllegalArgumentException("vector numDimensions must be <= VectorValues.MAX_DIMENSIONS (=" + VectorValues.MAX_DIMENSIONS + "); got " + numDimensions); + } + this.vectorDimension = numDimensions; Review comment: hmm I noticed we do not do this for Points. I think that in practice we do not expect users to create these FieldTypes - they are created implicitly when adding values using VectorField constructors - we create a new Type for every Field unless the user cleverly creates a generic Field with a float[] as its `fieldsData` and an appropriate FieldType. Efficient usage would seem to be: create a VectorField, add it to a doc, update its value and repeat. Anyway I'll add the checking ---------------------------------------------------------------- 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