提交 b92ad3ed 编写于 作者: X xige-16 提交者: yefu.chen

Fix error when search on collection without partitions

Signed-off-by: Nxige-16 <xi.ge@zilliz.com>
上级 ec8ad899
......@@ -4,7 +4,6 @@ import "C"
import (
"context"
"errors"
"regexp"
"strconv"
"strings"
"sync"
......@@ -250,16 +249,22 @@ func (ss *searchService) search(msg msgstream.TsMsg) error {
var searchPartitionIDs []UniqueID
partitionIDsInQuery := searchMsg.PartitionIDs
if len(partitionIDsInQuery) == 0 {
if len(partitionIDsInCol) == 0 {
return errors.New("can't find any partition in this collection on query node")
}
searchPartitionIDs = partitionIDsInCol
} else {
for _, id := range partitionIDsInCol {
for _, toMatchID := range partitionIDsInQuery {
re := regexp.MustCompile("^" + strconv.FormatInt(toMatchID, 10) + "$")
if re.MatchString(strconv.FormatInt(id, 10)) {
searchPartitionIDs = append(searchPartitionIDs, id)
}
findPartition := false
for _, id := range partitionIDsInQuery {
_, err := ss.replica.getPartitionByID(id)
if err == nil {
searchPartitionIDs = append(searchPartitionIDs, id)
findPartition = true
}
}
if !findPartition {
return errors.New("partition to be searched not exist in query node")
}
}
for _, partitionID := range searchPartitionIDs {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册