mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 12:59:23 +08:00
23 lines
520 B
Go
23 lines
520 B
Go
|
package proxy
|
||
|
|
||
|
import (
|
||
|
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
|
||
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
||
|
"github.com/milvus-io/milvus/internal/util/funcutil"
|
||
|
)
|
||
|
|
||
|
type cntReducer struct {
|
||
|
}
|
||
|
|
||
|
func (r *cntReducer) Reduce(results []*internalpb.RetrieveResults) (*milvuspb.QueryResults, error) {
|
||
|
cnt := int64(0)
|
||
|
for _, res := range results {
|
||
|
c, err := funcutil.CntOfInternalResult(res)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
cnt += c
|
||
|
}
|
||
|
return funcutil.WrapCntToQueryResults(cnt), nil
|
||
|
}
|