fix: ignore growing option is lost at hibridsearch (#39900)

issue: #39892
pr: #39799

Signed-off-by: chyezh <chyezh@outlook.com>
pull/39926/head
Zhen Ye 2025-02-17 15:30:15 +08:00 committed by GitHub
parent 3a951f2160
commit 56c1a8d462
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 575 additions and 513 deletions

View File

@ -2747,3 +2747,17 @@ func (t *ListResourceGroupsTask) Execute(ctx context.Context) error {
func (t *ListResourceGroupsTask) PostExecute(ctx context.Context) error { func (t *ListResourceGroupsTask) PostExecute(ctx context.Context) error {
return nil 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
}

View File

@ -365,18 +365,9 @@ func (t *queryTask) PreExecute(ctx context.Context) error {
log.Debug("Validate partition names.") log.Debug("Validate partition names.")
// fetch search_growing from query param // fetch search_growing from query param
var ignoreGrowing bool if t.RetrieveRequest.IgnoreGrowing, err = isIgnoreGrowing(t.request.GetQueryParams()); err != nil {
for i, kv := range t.request.GetQueryParams() { return err
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
}
} }
t.RetrieveRequest.IgnoreGrowing = ignoreGrowing
queryParams, err := parseQueryParams(t.request.GetQueryParams()) queryParams, err := parseQueryParams(t.request.GetQueryParams())
if err != nil { if err != nil {

View File

@ -193,19 +193,9 @@ func (t *searchTask) PreExecute(ctx context.Context) error {
} }
t.SearchRequest.Nq = nq t.SearchRequest.Nq = nq
var ignoreGrowing bool if t.SearchRequest.IgnoreGrowing, err = isIgnoreGrowing(t.request.SearchParams); err != nil {
// parse common search params return err
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
}
} }
t.SearchRequest.IgnoreGrowing = ignoreGrowing
outputFieldIDs, err := getOutputFieldIDs(t.schema, t.request.GetOutputFields()) outputFieldIDs, err := getOutputFieldIDs(t.schema, t.request.GetOutputFields())
if err != nil { if err != nil {
@ -369,6 +359,14 @@ func (t *searchTask) initAdvancedSearchRequest(ctx context.Context) error {
return err 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
}
}
internalSubReq := &internalpb.SubSearchRequest{ internalSubReq := &internalpb.SubSearchRequest{
Dsl: subReq.GetDsl(), Dsl: subReq.GetDsl(),
PlaceholderGroup: subReq.GetPlaceholderGroup(), PlaceholderGroup: subReq.GetPlaceholderGroup(),
@ -381,6 +379,7 @@ func (t *searchTask) initAdvancedSearchRequest(ctx context.Context) error {
MetricType: queryInfo.GetMetricType(), MetricType: queryInfo.GetMetricType(),
GroupByFieldId: t.rankParams.GetGroupByFieldId(), GroupByFieldId: t.rankParams.GetGroupByFieldId(),
GroupSize: t.rankParams.GetGroupSize(), GroupSize: t.rankParams.GetGroupSize(),
IgnoreGrowing: ignoreGrowing,
} }
internalSubReq.FieldId = queryInfo.GetQueryFieldId() internalSubReq.FieldId = queryInfo.GetQueryFieldId()

View File

@ -390,7 +390,7 @@ func (sd *shardDelegator) Search(ctx context.Context, req *querypb.SearchRequest
Nq: subReq.GetNq(), Nq: subReq.GetNq(),
Topk: subReq.GetTopk(), Topk: subReq.GetTopk(),
MetricType: subReq.GetMetricType(), MetricType: subReq.GetMetricType(),
IgnoreGrowing: req.GetReq().GetIgnoreGrowing(), IgnoreGrowing: subReq.GetIgnoreGrowing(),
Username: req.GetReq().GetUsername(), Username: req.GetReq().GetUsername(),
IsAdvanced: false, IsAdvanced: false,
GroupByFieldId: subReq.GetGroupByFieldId(), GroupByFieldId: subReq.GetGroupByFieldId(),

View File

@ -98,6 +98,7 @@ message SubSearchRequest {
int64 group_by_field_id = 10; int64 group_by_field_id = 10;
int64 group_size = 11; int64 group_size = 11;
int64 field_id = 12; int64 field_id = 12;
bool ignore_growing = 13;
} }
message SearchRequest { message SearchRequest {
@ -129,6 +130,7 @@ message SearchRequest {
int64 field_id = 25; int64 field_id = 25;
bool is_topk_reduce = 26; bool is_topk_reduce = 26;
bool is_recall_evaluation = 27; bool is_recall_evaluation = 27;
bool is_iterator = 28;
} }
message SubSearchResults { message SubSearchResults {
@ -194,6 +196,7 @@ message RetrieveRequest {
bool reduce_stop_for_best = 16; //deprecated bool reduce_stop_for_best = 16; //deprecated
int32 reduce_type = 17; int32 reduce_type = 17;
common.ConsistencyLevel consistency_level = 18; common.ConsistencyLevel consistency_level = 18;
bool is_iterator = 19;
} }
@ -324,7 +327,7 @@ message ImportFile {
} }
message ImportRequestInternal { message ImportRequestInternal {
int64 dbID = 1; int64 dbID = 1 [deprecated=true];
int64 collectionID = 2; int64 collectionID = 2;
string collection_name = 3; string collection_name = 3;
repeated int64 partitionIDs = 4; repeated int64 partitionIDs = 4;
@ -332,6 +335,8 @@ message ImportRequestInternal {
schema.CollectionSchema schema = 6; schema.CollectionSchema schema = 6;
repeated ImportFile files = 7; repeated ImportFile files = 7;
repeated common.KeyValuePair options = 8; repeated common.KeyValuePair options = 8;
uint64 data_timestamp = 9;
int64 jobID = 10;
} }
message ImportRequest { message ImportRequest {

File diff suppressed because it is too large Load Diff