Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: support hints param #860

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/ann_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (r *ANNSearchRequest) getMilvusSearchRequest(collectionInfo *collInfo, opts
"round_decimal": "-1",
ignoreGrowingKey: strconv.FormatBool(opt.IgnoreGrowing),
offsetKey: fmt.Sprintf("%d", opt.Offset),
hintsKey: opt.hints,
}
if opt.GroupByField != "" {
sp[groupByKey] = opt.GroupByField
Expand Down
1 change: 1 addition & 0 deletions client/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const (
groupByKey = `group_by_field`
iteratorKey = `iterator`
reduceForBestKey = `reduce_stop_for_best`
hintsKey = `hints`
)

func (c *GrpcClient) HybridSearch(ctx context.Context, collName string, partitions []string, limit int, outputFields []string, reranker Reranker, subRequests []*ANNSearchRequest, opts ...SearchQueryOptionFunc) ([]SearchResult, error) {
Expand Down
7 changes: 7 additions & 0 deletions client/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ type SearchQueryOption struct {

isIterator bool
reduceForBest bool
hints string
congqixia marked this conversation as resolved.
Show resolved Hide resolved
}

// SearchQueryOptionFunc is a function which modifies SearchOption
Expand Down Expand Up @@ -180,6 +181,12 @@ func WithIgnoreGrowing() SearchQueryOptionFunc {
}
}

func WithHints(hints string) SearchQueryOptionFunc {
return func(option *SearchQueryOption) {
option.hints = hints
}
}

// WithOffset returns search/query option with offset.
func WithOffset(offset int64) SearchQueryOptionFunc {
return func(option *SearchQueryOption) {
Expand Down
Loading