Skip to content

Commit

Permalink
[fix][store] Fixup document bool tokenizer issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
visualYJD authored and rock-git committed Oct 24, 2024
1 parent feb765f commit 79fe93a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/client_v2/document_index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/document/document_index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ butil::Status DocumentIndex::Add(const std::vector<pb::common::DocumentWithId>&
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 =
Expand Down

0 comments on commit 79fe93a

Please sign in to comment.