diff --git a/src/client_v2/document_index.cc b/src/client_v2/document_index.cc index 9408ad43d..f37e67245 100644 --- a/src/client_v2/document_index.cc +++ b/src/client_v2/document_index.cc @@ -131,10 +131,15 @@ void SendDocumentAdd(DocumentAddOptions const& opt) { } // col6 bool { - if (opt.document_bool == "true" || opt.document_bool == "false") { + if (opt.document_bool == "true") { dingodb::pb::common::DocumentValue document_value1; document_value1.set_field_type(dingodb::pb::common::ScalarFieldType::BOOL); - document_value1.mutable_field_value()->set_string_data(opt.document_bool); + document_value1.mutable_field_value()->set_bool_data(true); + (*document_data)["col6"] = document_value1; + } else if (opt.document_bool == "false") { + dingodb::pb::common::DocumentValue document_value1; + document_value1.set_field_type(dingodb::pb::common::ScalarFieldType::BOOL); + document_value1.mutable_field_value()->set_bool_data(false); (*document_data)["col6"] = document_value1; } } diff --git a/src/document/document_index.cc b/src/document/document_index.cc index 71eabfb16..ef972e969 100644 --- a/src/document/document_index.cc +++ b/src/document/document_index.cc @@ -269,7 +269,11 @@ butil::Status DocumentIndex::Add(const std::vector& break; case pb::common::ScalarFieldType::BOOL: bool_column_names.push_back(field_name); - bool_column_docs.push_back(document_value.field_value().string_data()); + if (document_value.field_value().bool_data()) { + bool_column_docs.push_back("true"); + } else { + bool_column_docs.push_back("false"); + } break; default: std::string err_msg =