hahahahbenny commented on code in PR #2856: URL: https://github.com/apache/incubator-hugegraph/pull/2856#discussion_r2292316991
########## hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java: ########## @@ -235,6 +235,13 @@ public void checkCreate(boolean isBatch) { E.checkArgumentNotNull(this.indexType, "The index type of index label '%s' " + "can't be null", this.name); + if(this.indexType == IndexType.VECTOR){ + E.checkArgumentNotNull(this.userdata, + "The user_data(dimension and metric) of vector index " + + "label '%s' " + + "can't be null", this.name); + } Review Comment: ok, I will fix it ########## hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java: ########## @@ -526,6 +532,21 @@ private void checkFields(Set<Id> propertyIds) { "Search index can only build on text property, " + "but got %s(%s)", dataType, field); } + + // Vector index must build on float list + if(this.indexType.isVector()){ + E.checkArgument(fields.size() == 1, + "vector index can only build on " + + "one field, but got %s fields: '%s'", + fields.size(), fields); + String field = fields.iterator().next(); + DataType dataType = this.graph().propertyKey(field).dataType(); + Cardinality cardinality = this.graph().propertyKey(field).cardinality(); + E.checkArgument((dataType == DataType.FLOAT) && + (cardinality == Cardinality.LIST), + "vector index can only build on Float List, " + + "but got %s(%s)", dataType, cardinality); + } Review Comment: ok, I will fix it -- 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. To unsubscribe, e-mail: issues-unsubscr...@hugegraph.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@hugegraph.apache.org For additional commands, e-mail: issues-h...@hugegraph.apache.org