mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
The 'num' in return of search is incorrect when use http-api (#3975)
* The 'num' in return of search is incorrect when use http-api Signed-off-by: fishpenguin <kun.yu@zilliz.com> * Add collection name check in GetCollectionInfo Signed-off-by: fishpenguin <kun.yu@zilliz.com>
This commit is contained in:
parent
5d9248a1e9
commit
76ed2fb45c
@ -52,6 +52,7 @@ Please mark all changes in change log and use the issue from GitHub
|
||||
- \#3741 Inconsistent parameter names
|
||||
- \#3811 c++ sdk segmentation fault
|
||||
- \#3946 The result format is wrong returned by 'get collections'
|
||||
- \#3962 The 'num' in return of search is incorrect when use http-api
|
||||
|
||||
## Feature
|
||||
- \#2319 Redo metadata to support MVCC
|
||||
|
||||
@ -43,6 +43,12 @@ GetCollectionInfoReq::OnExecute() {
|
||||
|
||||
STATUS_CHECK(ValidateCollectionName(collection_name_));
|
||||
|
||||
bool exist = false;
|
||||
STATUS_CHECK(DBWrapper::DB()->HasCollection(collection_name_, exist));
|
||||
if (!exist) {
|
||||
return Status(SERVER_COLLECTION_NOT_EXIST, "Collection not exist: " + collection_name_);
|
||||
}
|
||||
|
||||
engine::snapshot::CollectionPtr collection;
|
||||
engine::snapshot::FieldElementMappings field_mappings;
|
||||
STATUS_CHECK(DBWrapper::DB()->GetCollectionInfo(collection_name_, collection, field_mappings));
|
||||
|
||||
@ -826,7 +826,7 @@ WebRequestHandler::Search(const std::string& collection_name, const nlohmann::js
|
||||
}
|
||||
|
||||
nlohmann::json result_json;
|
||||
result_json["num"] = result->row_num_;
|
||||
result_json["nq"] = result->row_num_;
|
||||
if (result->row_num_ == 0) {
|
||||
result_json["result"] = std::vector<int64_t>();
|
||||
result_str = result_json.dump();
|
||||
|
||||
@ -825,7 +825,7 @@ TEST_F(WebControllerTest, SEARCH) {
|
||||
// ASSERT_EQ(milvus::server::web::StatusCode::SUCCESS, error_dto->code);
|
||||
auto result_json = nlohmann::json::parse(response->readBodyToString()->std_str());
|
||||
ASSERT_TRUE(result_json.contains("data"));
|
||||
ASSERT_EQ(1, result_json["data"]["num"].get<int64_t>());
|
||||
ASSERT_EQ(1, result_json["data"]["nq"].get<int64_t>());
|
||||
}
|
||||
|
||||
TEST_F(WebControllerTest, INDEX) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user