mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 21:09:06 +08:00
41af0a98fa
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
27 lines
952 B
Go
27 lines
952 B
Go
package proxy
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
|
"github.com/milvus-io/milvus/internal/proto/planpb"
|
|
)
|
|
|
|
type milvusReducer interface {
|
|
Reduce([]*internalpb.RetrieveResults) (*milvuspb.QueryResults, error)
|
|
}
|
|
|
|
func createMilvusReducer(ctx context.Context, params *queryParams, req *internalpb.RetrieveRequest, schema *schemapb.CollectionSchema, plan *planpb.PlanNode, collectionName string) milvusReducer {
|
|
if plan.GetQuery().GetIsCount() {
|
|
return &cntReducer{}
|
|
} else if req.GetIterationExtensionReduceRate() > 0 {
|
|
params.limit = params.limit * req.GetIterationExtensionReduceRate()
|
|
if params.limit > Params.QuotaConfig.TopKLimit.GetAsInt64() {
|
|
params.limit = Params.QuotaConfig.TopKLimit.GetAsInt64()
|
|
}
|
|
}
|
|
return newDefaultLimitReducer(ctx, params, req, schema, collectionName)
|
|
}
|