Skip to content

Commit

Permalink
enhance: support recall in SearchResult
Browse files Browse the repository at this point in the history
Signed-off-by: chasingegg <[email protected]>
  • Loading branch information
chasingegg committed Dec 17, 2024
1 parent 20bb835 commit 4109eef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions client/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,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 the 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.3.4-0.20241120015424-93892e628c69
github.com/milvus-io/milvus-proto/go-api/v2 v2.5.0-beta.0.20241125085227-a6cba3e091b5
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 @@ -157,8 +157,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.3.4-0.20241120015424-93892e628c69 h1:Qt0Bv2Fum3EX3OlkuQYHJINBzeU4oEuHy2lXSfB/gZw=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20241120015424-93892e628c69/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
github.com/milvus-io/milvus-proto/go-api/v2 v2.5.0-beta.0.20241125085227-a6cba3e091b5 h1:E0FAEtCM3/XX/nesgEDEdkXB3GOSCLWKnOv7PipaRzU=
github.com/milvus-io/milvus-proto/go-api/v2 v2.5.0-beta.0.20241125085227-a6cba3e091b5/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

0 comments on commit 4109eef

Please sign in to comment.