Skip to content

Commit

Permalink
enhance: [2.4] support recall in SearchResult (#863)
Browse files Browse the repository at this point in the history
#861

---------

Signed-off-by: chasingegg <[email protected]>
  • Loading branch information
chasingegg authored Dec 18, 2024
1 parent 2f95159 commit d0db4d6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions client/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ func (c *GrpcClient) handleSearchResult(schema *entity.Schema, outputFields []st
Scores: results.GetScores()[offset : offset+rc],
}

if len(results.GetRecalls()) > 0 {
entry.Recall = results.GetRecalls()[i]
}

entry.IDs, entry.Err = entity.IDColumns(schema, results.GetIds(), offset, offset+rc)
if entry.Err != nil {
continue
Expand Down
1 change: 1 addition & 0 deletions client/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type SearchResult struct {
IDs entity.Column // auto generated id, can be mapped to the columns from `Insert` API
Fields ResultSet //[]entity.Column // output field data
Scores []float32 // distance to the target vector
Recall float32 // recall of one query vector's search result (estimated by zilliz cloud)
Err error // search error if any
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/go-faker/faker/v4 v4.1.0
github.com/golang/protobuf v1.5.2
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/milvus-io/milvus-proto/go-api/v2 v2.4.17-0.20241120092224-a1c2ac2fd2c1
github.com/milvus-io/milvus-proto/go-api/v2 v2.4.18-0.20241125085427-d06253758dac
github.com/stretchr/testify v1.8.1
github.com/tidwall/gjson v1.14.4
github.com/x448/float16 v0.8.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8=
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
github.com/milvus-io/milvus-proto/go-api/v2 v2.4.17-0.20241120092224-a1c2ac2fd2c1 h1:WLm5qrm6vPAnuhrKcA0htuaDboG5YOvgzfZgMKEzsGc=
github.com/milvus-io/milvus-proto/go-api/v2 v2.4.17-0.20241120092224-a1c2ac2fd2c1/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
github.com/milvus-io/milvus-proto/go-api/v2 v2.4.18-0.20241125085427-d06253758dac h1:19Q/+bSE6gBKvDerf1pqMEqJ1oqGt8vXaiUlp2VY+W8=
github.com/milvus-io/milvus-proto/go-api/v2 v2.4.18-0.20241125085427-d06253758dac/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down
2 changes: 1 addition & 1 deletion test/testcases/load_release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestLoadEmptyPartitionName(t *testing.T) {

// load partition with empty partition names
errLoadEmpty := mc.LoadPartitions(ctx, collName, []string{""}, false)
common.CheckErr(t, errLoadEmpty, false, "partition not found[partition=]")
common.CheckErr(t, errLoadEmpty, true)
}

// test load partitions with empty slice []string{}
Expand Down

0 comments on commit d0db4d6

Please sign in to comment.