diff --git a/client/ann_request.go b/client/ann_request.go index aa511db3..f8889499 100644 --- a/client/ann_request.go +++ b/client/ann_request.go @@ -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 diff --git a/client/data.go b/client/data.go index 2232fe81..bee6da15 100644 --- a/client/data.go +++ b/client/data.go @@ -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) { diff --git a/client/options.go b/client/options.go index 3e51ba98..98ca5b2c 100644 --- a/client/options.go +++ b/client/options.go @@ -151,6 +151,7 @@ type SearchQueryOption struct { isIterator bool reduceForBest bool + hints string } // SearchQueryOptionFunc is a function which modifies SearchOption @@ -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) {