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

fix: ignore growing option is lost at hibridsearch #39893

Closed
Closed
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
14 changes: 14 additions & 0 deletions internal/proxy/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -2747,3 +2747,17 @@ func (t *ListResourceGroupsTask) Execute(ctx context.Context) error {
func (t *ListResourceGroupsTask) PostExecute(ctx context.Context) error {
return nil
}

// isIgnoreGrowing is used to check if the request should ignore growing
func isIgnoreGrowing(params []*commonpb.KeyValuePair) (bool, error) {
for _, kv := range params {
if kv.GetKey() == IgnoreGrowingKey {
ignoreGrowing, err := strconv.ParseBool(kv.GetValue())
if err != nil {
return false, errors.New("parse ignore growing field failed")
}
return ignoreGrowing, nil
}
}
return false, nil
}
13 changes: 2 additions & 11 deletions internal/proxy/task_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,18 +359,9 @@
log.Debug("Validate partition names.")

// fetch search_growing from query param
var ignoreGrowing bool
for i, kv := range t.request.GetQueryParams() {
if kv.GetKey() == IgnoreGrowingKey {
ignoreGrowing, err = strconv.ParseBool(kv.Value)
if err != nil {
return errors.New("parse search growing failed")
}
t.request.QueryParams = append(t.request.GetQueryParams()[:i], t.request.GetQueryParams()[i+1:]...)
break
}
if t.RetrieveRequest.IgnoreGrowing, err = isIgnoreGrowing(t.request.GetQueryParams()); err != nil {
return err

Check warning on line 363 in internal/proxy/task_query.go

View check run for this annotation

Codecov / codecov/patch

internal/proxy/task_query.go#L363

Added line #L363 was not covered by tests
}
t.RetrieveRequest.IgnoreGrowing = ignoreGrowing

queryParams, err := parseQueryParams(t.request.GetQueryParams())
if err != nil {
Expand Down
23 changes: 11 additions & 12 deletions internal/proxy/task_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,9 @@
}
t.SearchRequest.Nq = nq

var ignoreGrowing bool
// parse common search params
for i, kv := range t.request.GetSearchParams() {
if kv.GetKey() == IgnoreGrowingKey {
ignoreGrowing, err = strconv.ParseBool(kv.GetValue())
if err != nil {
return errors.New("parse search growing failed")
}
t.request.SearchParams = append(t.request.GetSearchParams()[:i], t.request.GetSearchParams()[i+1:]...)
break
}
if t.SearchRequest.IgnoreGrowing, err = isIgnoreGrowing(t.request.SearchParams); err != nil {
return err
}
t.SearchRequest.IgnoreGrowing = ignoreGrowing

outputFieldIDs, err := getOutputFieldIDs(t.schema, t.request.GetOutputFields())
if err != nil {
Expand Down Expand Up @@ -370,6 +360,14 @@
return err
}

ignoreGrowing := t.SearchRequest.IgnoreGrowing
if !ignoreGrowing {
// fetch ignore_growing from sub search param if not set in search request
if ignoreGrowing, err = isIgnoreGrowing(subReq.GetSearchParams()); err != nil {
return err
}

Check warning on line 368 in internal/proxy/task_search.go

View check run for this annotation

Codecov / codecov/patch

internal/proxy/task_search.go#L367-L368

Added lines #L367 - L368 were not covered by tests
}

internalSubReq := &internalpb.SubSearchRequest{
Dsl: subReq.GetDsl(),
PlaceholderGroup: subReq.GetPlaceholderGroup(),
Expand All @@ -382,6 +380,7 @@
MetricType: queryInfo.GetMetricType(),
GroupByFieldId: t.rankParams.GetGroupByFieldId(),
GroupSize: t.rankParams.GetGroupSize(),
IgnoreGrowing: ignoreGrowing,
}

internalSubReq.FieldId = queryInfo.GetQueryFieldId()
Expand Down
2 changes: 1 addition & 1 deletion internal/querynodev2/delegator/delegator.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (sd *shardDelegator) Search(ctx context.Context, req *querypb.SearchRequest
Nq: subReq.GetNq(),
Topk: subReq.GetTopk(),
MetricType: subReq.GetMetricType(),
IgnoreGrowing: req.GetReq().GetIgnoreGrowing(),
IgnoreGrowing: subReq.GetIgnoreGrowing(),
Username: req.GetReq().GetUsername(),
IsAdvanced: false,
GroupByFieldId: subReq.GetGroupByFieldId(),
Expand Down
1 change: 1 addition & 0 deletions pkg/proto/internal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ message SubSearchRequest {
int64 group_by_field_id = 10;
int64 group_size = 11;
int64 field_id = 12;
bool ignore_growing = 13;
}

message SearchRequest {
Expand Down
Loading
Loading