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