Skip to content

Commit

Permalink
fix: keep inner topK to avoid exceeding efSearch (#36284)
Browse files Browse the repository at this point in the history
issue: ##36243

Signed-off-by: zhenshan.cao <[email protected]>
  • Loading branch information
czs007 authored Sep 16, 2024
1 parent 763fd0d commit dcd904d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions internal/proxy/search_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ func parseSearchInfo(searchParamsPair []*commonpb.KeyValuePair, schema *schemapb
}
topK = externalLimit
} else {
if topKInParam < externalLimit {
topK = externalLimit
} else {
topK = topKInParam
}
topK = topKInParam
}
}

Expand Down
6 changes: 3 additions & 3 deletions internal/proxy/task_search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,7 @@ func TestTaskSearch_parseSearchInfo(t *testing.T) {
info, offset, err := parseSearchInfo(offsetParam, nil, rank)
assert.NoError(t, err)
assert.NotNil(t, info)
assert.Equal(t, externalLimit, info.GetTopk())
assert.Equal(t, int64(10), info.GetTopk())
assert.Equal(t, int64(0), offset)
})

Expand Down Expand Up @@ -2446,13 +2446,13 @@ func TestTaskSearch_parseSearchInfo(t *testing.T) {
schema := &schemapb.CollectionSchema{
Fields: fields,
}
info, _, err := parseSearchInfo(normalParam, schema, false)
info, _, err := parseSearchInfo(normalParam, schema, nil)
assert.Nil(t, info)
assert.Error(t, err)
assert.True(t, strings.Contains(err.Error(), "exceeds configured max group size"))

resetSearchParamsValue(normalParam, GroupSizeKey, `10`)
info, _, err = parseSearchInfo(normalParam, schema, false)
info, _, err = parseSearchInfo(normalParam, schema, nil)
assert.NotNil(t, info)
assert.NoError(t, err)
})
Expand Down

0 comments on commit dcd904d

Please sign in to comment.