From 388eb91320e01b0457a0eda5d635f8c182cd6cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ante=20Pu=C5=A1i=C4=87?= <ante.pusic@memgraph.io> Date: Mon, 5 Feb 2024 12:02:03 +0100 Subject: [PATCH] Fix SetPropertiesCursor and empty properties JSON --- src/query/plan/operator.cpp | 1 + src/storage/v2/indices/text_index.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/query/plan/operator.cpp b/src/query/plan/operator.cpp index 4aeacd5bd..7a9ef6228 100644 --- a/src/query/plan/operator.cpp +++ b/src/query/plan/operator.cpp @@ -3044,6 +3044,7 @@ bool SetProperties::SetPropertiesCursor::Pull(Frame &frame, ExecutionContext &co } #endif SetPropertiesOnRecord(&lhs.ValueVertex(), rhs, self_.op_, &context, cached_name_id_); + context.db_accessor->TextIndexUpdateVertex(&lhs.ValueVertex()); break; case TypedValue::Type::Edge: #ifdef MG_ENTERPRISE diff --git a/src/storage/v2/indices/text_index.cpp b/src/storage/v2/indices/text_index.cpp index f786ab443..8ae806372 100644 --- a/src/storage/v2/indices/text_index.cpp +++ b/src/storage/v2/indices/text_index.cpp @@ -26,7 +26,7 @@ void TextIndex::AddNode(Vertex *vertex_after_update, Storage *storage, const std // NOTE: Text indexes are presently all-property indices. If we allow text indexes restricted to specific properties, // an indexable document should be created for each applicable index. nlohmann::json document = {}; - nlohmann::json properties = {}; + nlohmann::json properties = nlohmann::json::value_t::object; for (const auto &[prop_id, prop_value] : vertex_after_update->properties.Properties()) { switch (prop_value.type()) { case PropertyValue::Type::Bool: @@ -238,7 +238,7 @@ bool TextIndex::CreateIndex(std::string index_name, LabelId label, memgraph::que } nlohmann::json document = {}; - nlohmann::json properties = {}; + nlohmann::json properties = nlohmann::json::value_t::object; for (const auto &[prop_id, prop_name] : indexed_properties) { const auto prop_value = v.GetProperty(View::NEW, prop_id).GetValue(); switch (prop_value.type()) { @@ -334,7 +334,7 @@ bool TextIndex::RecoverIndex(std::string index_name, LabelId label, } nlohmann::json document = {}; - nlohmann::json properties = {}; + nlohmann::json properties = nlohmann::json::value_t::object; for (const auto &[prop_id, prop_name] : indexed_properties) { if (!vertex_properties.contains(prop_id)) { continue;