milvus-sdk-go
milvus-sdk-go copied to clipboard
[Bug]: Create sparse index with different ways gets different default index name
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
image: master-20240415-fd971a43-amd64 sdk: go-master
- create sparse index with
entity.NewGenericIndex
gets default index name: vector field name - create sparse index with
entity.NewIndexSparseInverted
gets default index name: SparseInverted
2024/04/17 11:18:05 index_test.go:702: sparseVec SPARSE_INVERTED_INDEX map[drop_ratio_build:0.2 index_type:SPARSE_INVERTED_INDEX metric_type:IP]
2024/04/17 11:18:15 index_test.go:702: SparseInverted SPARSE_INVERTED_INDEX map[index_type:SPARSE_INVERTED_INDEX metric_type:IP params:{"drop_ratio_build":"0.2"}]
case:
func TestCreateIndexSparseVector(t *testing.T) {
t.Parallel()
idxInverted := entity.NewGenericIndex(common.DefaultSparseVecFieldName, "SPARSE_INVERTED_INDEX", map[string]string{"drop_ratio_build": "0.2", "metric_type": "IP"})
idxWand := entity.NewGenericIndex(common.DefaultSparseVecFieldName, "SPARSE_WAND", map[string]string{"drop_ratio_build": "0.3", "metric_type": "IP"})
idxInverted1, _ := entity.NewIndexSparseInverted(entity.IP, 0.2)
idxWand1, _ := entity.NewIndexSparseWAND(entity.IP, 0.3)
for _, idx := range []entity.Index{idxInverted, idxWand, idxInverted1, idxWand1} {
ctx := createContext(t, time.Second*common.DefaultTimeout)
//connect
mc := createMilvusClient(ctx, t)
// create collection with all datatype
cp := CollectionParams{CollectionFieldsType: Int64VarcharSparseVec, AutoID: false, EnableDynamicField: true,
ShardsNum: common.DefaultShards, Dim: common.DefaultDim, MaxLength: 300}
collName := createCollection(ctx, t, mc, cp)
// insert
dp := DataParams{CollectionName: collName, PartitionName: "", CollectionFieldsType: Int64VarcharSparseVec,
start: 0, nb: common.DefaultNb, dim: common.DefaultDim, EnableDynamicField: true, WithRows: false}
_, _ = insertData(ctx, t, mc, dp, common.WithSparseVectorLen(100))
mc.Flush(ctx, collName, false)
// create index
err := mc.CreateIndex(ctx, collName, common.DefaultSparseVecFieldName, idx, false)
common.CheckErr(t, err, true)
// describe index
idx2, err := mc.DescribeIndex(ctx, collName, common.DefaultSparseVecFieldName)
log.Println(idx.Name(), idx.IndexType(), idx.Params())
log.Println(idx2[0].Name(), idx2[0].IndexType(), idx2[0].Params())
common.CheckErr(t, err, true)
common.CheckIndexResult(t, idx2, idx)
}
}
Expected Behavior
No response
Steps To Reproduce
No response
Environment
No response
Anything else?
No response
/assign @congqixia
@ThreadDao @congqixia Can I work on this issue if it hasn't been picked yet?
@siddarth99 sure /assign @siddarth99 /unassign
server 2.5 Supports autoIndex of fields other than Array and Json
fixed