Skip to content

Commit

Permalink
Support probing diskann (#164)
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Jul 10, 2023
1 parent 677b3f6 commit c6f2cd8
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions states/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,26 @@ func getMockSearchRequest(ctx context.Context, cli clientv3.KV, basePath string,
DmlChannels: []string{},
}
return r, nil
case "DISKANN":
metricType := common.GetKVPair(index.GetIndexInfo().GetIndexParams(), "metric_type")
if metricType == "" {
metricType = common.GetKVPair(index.GetIndexInfo().GetTypeParams(), "metric_type")
if metricType == "" {
fmt.Println("no metric_type in IndexParams or TypeParams")
return nil, fmt.Errorf("no metric_type in IndexParams or TypeParams, bad meta")
}
fmt.Println("metric_type is in TypeParams instead of IndexParams")
}

topK := int64(10)
spStr := genSearchDISKANNParamBytes(20)
req.SerializedExprPlan = getSearchPlan(vectorField.DataType == models.DataTypeBinaryVector, pkField.FieldID, vectorField.FieldID, topK, metricType, string(spStr))
r := &querypbv2.SearchRequest{
Req: req,
FromShardLeader: false,
DmlChannels: []string{},
}
return r, nil

default:
return nil, fmt.Errorf("probing index type %s not supported yet", indexType)
Expand Down Expand Up @@ -506,6 +526,13 @@ func genSearchHNSWParamBytes(ef int64) []byte {
return bs
}

func genSearchDISKANNParamBytes(searchList int) []byte {
m := make(map[string]any)
m["search_list"] = searchList
bs, _ := json.Marshal(m)
return bs
}

func genFloatVector(dim int64) FloatVector {
result := make([]float32, 0, dim)

Expand Down

0 comments on commit c6f2cd8

Please sign in to comment.