From 1c54baeec3774c2f9b682147386639e3b2f3b346 Mon Sep 17 00:00:00 2001 From: yukun Date: Mon, 3 Aug 2020 10:41:48 +0800 Subject: [PATCH] Fix bug (#3099) * Fix Block Format Read bug Signed-off-by: fishpenguin * Fix Search crash bug Signed-off-by: fishpenguin --- core/src/db/DBImpl.cpp | 10 +++++++--- core/src/server/ValidationUtil.cpp | 4 ++-- core/src/server/delivery/request/CreateIndexReq.cpp | 2 -- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/core/src/db/DBImpl.cpp b/core/src/db/DBImpl.cpp index 5047f7ed..7bd702fd 100644 --- a/core/src/db/DBImpl.cpp +++ b/core/src/db/DBImpl.cpp @@ -619,12 +619,16 @@ DBImpl::Query(const server::ContextPtr& context, const query::QueryPtr& query_pt return job->status(); } - result = job->query_result(); + if (job->query_result()) { + result = job->query_result(); + } // step 4: get entities by result ids std::vector valid_row; - STATUS_CHECK(GetEntityByID(query_ptr->collection_id, result->result_ids_, query_ptr->field_names, valid_row, - result->data_chunk_)); + if (!query_ptr->field_names.empty()) { + STATUS_CHECK(GetEntityByID(query_ptr->collection_id, result->result_ids_, query_ptr->field_names, valid_row, + result->data_chunk_)); + } // step 5: filter entities by field names // std::vector filter_attrs; diff --git a/core/src/server/ValidationUtil.cpp b/core/src/server/ValidationUtil.cpp index c3c569d1..8516dbfe 100644 --- a/core/src/server/ValidationUtil.cpp +++ b/core/src/server/ValidationUtil.cpp @@ -165,7 +165,7 @@ Status ValidateIndexType(const std::string& index_type) { // Index name shouldn't be empty. if (index_type.empty()) { - std::string msg = "Index name should not be empty."; + std::string msg = "Index type should not be empty."; LOG_SERVER_ERROR_ << msg; return Status(SERVER_INVALID_FIELD_NAME, msg); } @@ -187,7 +187,7 @@ ValidateIndexType(const std::string& index_type) { }; if (s_valid_index_names.find(index_type) == s_valid_index_names.end()) { - std::string msg = "Invalid index name: " + index_type; + std::string msg = "Invalid index type: " + index_type; LOG_SERVER_ERROR_ << msg; return Status(SERVER_INVALID_INDEX_TYPE, msg); } diff --git a/core/src/server/delivery/request/CreateIndexReq.cpp b/core/src/server/delivery/request/CreateIndexReq.cpp index c50c2d5b..f36b8bdb 100644 --- a/core/src/server/delivery/request/CreateIndexReq.cpp +++ b/core/src/server/delivery/request/CreateIndexReq.cpp @@ -53,8 +53,6 @@ CreateIndexReq::OnExecute() { STATUS_CHECK(ValidateFieldName(field_name_)); - STATUS_CHECK(ValidateIndexType(index_name_)); - // only process root collection, ignore partition collection engine::snapshot::CollectionPtr collection; engine::snapshot::FieldElementMappings fields_schema; -- GitLab