mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 03:48:37 +08:00
Make TopK Limit configurable (#21151)
Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com> Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com>
This commit is contained in:
parent
0011b65338
commit
e6374901f9
@ -58,12 +58,6 @@ const (
|
||||
|
||||
// DefaultStringIndexType name of default index type for varChar/string field
|
||||
DefaultStringIndexType = "Trie"
|
||||
|
||||
// Search limit, which applies on:
|
||||
// maximum # of results to return (topK), and
|
||||
// maximum # of search requests (nq).
|
||||
// Check https://milvus.io/docs/limitations.md for more details.
|
||||
searchCountLimit = 16384
|
||||
)
|
||||
|
||||
var logger = log.L().WithOptions(zap.Fields(zap.String("role", typeutil.ProxyRole)))
|
||||
@ -85,9 +79,8 @@ func isNumber(c uint8) bool {
|
||||
}
|
||||
|
||||
func validateLimit(limit int64) error {
|
||||
// TODO make this configurable
|
||||
if limit <= 0 || limit > searchCountLimit {
|
||||
return fmt.Errorf("should be in range [1, %d], but got %d", searchCountLimit, limit)
|
||||
if limit <= 0 || limit > Params.CommonCfg.TopKLimit.GetAsInt64() {
|
||||
return fmt.Errorf("should be in range [1, %d], but got %d", Params.CommonCfg.TopKLimit.GetAsInt64(), limit)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -145,6 +145,12 @@ type commonConfig struct {
|
||||
GracefulTime ParamItem
|
||||
GracefulStopTimeout ParamItem // unit: s
|
||||
|
||||
// Search limit, which applies on:
|
||||
// maximum # of results to return (topK), and
|
||||
// maximum # of search requests (nq).
|
||||
// Check https://milvus.io/docs/limitations.md for more details.
|
||||
TopKLimit ParamItem
|
||||
|
||||
StorageType ParamItem
|
||||
SimdType ParamItem
|
||||
|
||||
@ -418,6 +424,13 @@ func (p *commonConfig) init(base *BaseTable) {
|
||||
}
|
||||
p.GracefulStopTimeout.Init(base.mgr)
|
||||
|
||||
p.TopKLimit = ParamItem{
|
||||
Key: "common.topKLimit",
|
||||
Version: "2.2.1",
|
||||
DefaultValue: "16384",
|
||||
}
|
||||
p.TopKLimit.Init(base.mgr)
|
||||
|
||||
p.BeamWidthRatio = ParamItem{
|
||||
Key: "common.DiskIndex.BeamWidthRatio",
|
||||
Version: "2.0.0",
|
||||
|
Loading…
Reference in New Issue
Block a user