milvus-sdk-java icon indicating copy to clipboard operation
milvus-sdk-java copied to clipboard

对于scalar field的index创建,这个indexType应该非必选吧?

Open hellwhj opened this issue 3 years ago • 4 comments

https://github.com/milvus-io/milvus-sdk-java/blob/fbfba7975746dff19649b03ef5d64461cb562050/src/main/java/io/milvus/param/index/CreateIndexParam.java#L216

hellwhj avatar Jul 12 '22 08:07 hellwhj

Varchar is a new type that allow index, only support one type index currently, the index type is "Trie". I need to add this new type to the IndexType enum. Will do this in beta3.

yhmo avatar Jul 14 '22 07:07 yhmo

I add an index type "Trie" in pr #336. To create index for varchar field:

        CreateIndexParam indexParam = CreateIndexParam.newBuilder()
                .withCollectionName(randomCollectionName)
                .withFieldName("str_field")
                .withIndexName("stridx")
                .withIndexType(IndexType.TRIE)
                .withSyncMode(Boolean.TRUE)
                .withSyncWaitingInterval(500L)
                .withSyncWaitingTimeout(30L)
                .build();

        R<RpcStatus> createIndexR = client.createIndex(indexParam);

yhmo avatar Jul 14 '22 10:07 yhmo

我要创建的不是string类型字段的索引,而是int32或者int64的,也是用IndexType.TRIE吗?不对吧?应该用哪个?

hellwhj avatar Jul 19 '22 09:07 hellwhj

int8/int16/int32/int64/float/double 这些字段目前不支持建索引。 如果将来支持建索引的话,会有对应的IndexType。 如果现在对int8/int16/int32/int64/float/double 这些字段调用CreateIndex(),是没有效果的。

yhmo avatar Jul 21 '22 03:07 yhmo

2.2.8增加了IndexType.SORT,用于设置int8/int16/int32/int64/float/double的索引

yhmo avatar Jun 30 '23 06:06 yhmo