2020-08-25 07:38:35 +00:00
|
|
|
package reader
|
|
|
|
|
|
|
|
import (
|
2020-09-12 08:57:37 +00:00
|
|
|
"context"
|
2020-10-19 10:31:00 +00:00
|
|
|
masterPb "github.com/zilliztech/milvus-distributed/internal/proto/master"
|
|
|
|
msgPb "github.com/zilliztech/milvus-distributed/internal/proto/message"
|
2020-08-25 07:38:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ResultEntityIds []int64
|
|
|
|
|
2020-09-02 08:23:50 +00:00
|
|
|
type SearchResult struct {
|
2020-09-15 09:41:05 +00:00
|
|
|
ResultIds []int64
|
|
|
|
ResultDistances []float32
|
2020-09-02 08:23:50 +00:00
|
|
|
}
|
|
|
|
|
2020-09-16 07:21:10 +00:00
|
|
|
func (node *QueryNode) PublishSearchResult(results *msgPb.QueryResult) msgPb.Status {
|
2020-09-12 08:57:37 +00:00
|
|
|
var ctx = context.Background()
|
2020-08-25 07:38:35 +00:00
|
|
|
|
2020-10-15 13:31:50 +00:00
|
|
|
node.messageClient.SendResult(ctx, *results, results.ProxyId)
|
2020-09-16 07:21:10 +00:00
|
|
|
|
2020-09-08 02:39:09 +00:00
|
|
|
return msgPb.Status{ErrorCode: msgPb.ErrorCode_SUCCESS}
|
2020-09-02 08:23:50 +00:00
|
|
|
}
|
|
|
|
|
2020-09-15 09:41:05 +00:00
|
|
|
func (node *QueryNode) PublishFailedSearchResult() msgPb.Status {
|
|
|
|
var results = msgPb.QueryResult{
|
|
|
|
Status: &msgPb.Status{
|
|
|
|
ErrorCode: 1,
|
|
|
|
Reason: "Search Failed",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
var ctx = context.Background()
|
|
|
|
|
2020-10-15 13:31:50 +00:00
|
|
|
node.messageClient.SendResult(ctx, results, results.ProxyId)
|
2020-09-15 09:41:05 +00:00
|
|
|
return msgPb.Status{ErrorCode: msgPb.ErrorCode_SUCCESS}
|
|
|
|
}
|
|
|
|
|
2020-09-16 07:21:10 +00:00
|
|
|
func (node *QueryNode) PublicStatistic(statisticData *[]masterPb.SegmentStat) msgPb.Status {
|
|
|
|
var ctx = context.Background()
|
|
|
|
|
|
|
|
node.messageClient.SendSegmentsStatistic(ctx, statisticData)
|
|
|
|
|
2020-09-08 02:39:09 +00:00
|
|
|
return msgPb.Status{ErrorCode: msgPb.ErrorCode_SUCCESS}
|
2020-08-25 07:38:35 +00:00
|
|
|
}
|