diff --git a/src/storage/v2/disk/durable_metadata.cpp b/src/storage/v2/disk/durable_metadata.cpp index eb9743269..13d515af2 100644 --- a/src/storage/v2/disk/durable_metadata.cpp +++ b/src/storage/v2/disk/durable_metadata.cpp @@ -145,21 +145,23 @@ bool DurableMetadata::PersistLabelPropertyIndexAndExistenceConstraintDeletion(La return true; } -bool DurableMetadata::PersistTextIndexCreation(const std::string &index_name) { +bool DurableMetadata::PersistTextIndexCreation(const std::string &index_name, LabelId label) { + const std::string index_name_label_pair = index_name + "," + label.ToString(); if (auto text_index_store = durability_kvstore_.Get(kTextIndexStr); text_index_store.has_value()) { std::string &value = text_index_store.value(); value += "|"; - value += index_name; + value += index_name_label_pair; return durability_kvstore_.Put(kTextIndexStr, value); } - return durability_kvstore_.Put(kTextIndexStr, index_name); + return durability_kvstore_.Put(kTextIndexStr, index_name_label_pair); } -bool DurableMetadata::PersistTextIndexDeletion(const std::string &index_name) { +bool DurableMetadata::PersistTextIndexDeletion(const std::string &index_name, LabelId label) { + const std::string index_name_label_pair = index_name + "," + label.ToString(); if (auto text_index_store = durability_kvstore_.Get(kTextIndexStr); text_index_store.has_value()) { const std::string &value = text_index_store.value(); std::vector text_indices = utils::Split(value, "|"); - std::erase(text_indices, index_name); + std::erase(text_indices, index_name_label_pair); if (text_indices.empty()) { return durability_kvstore_.Delete(kTextIndexStr); } diff --git a/src/storage/v2/disk/durable_metadata.hpp b/src/storage/v2/disk/durable_metadata.hpp index 175aa944c..4aaa8a707 100644 --- a/src/storage/v2/disk/durable_metadata.hpp +++ b/src/storage/v2/disk/durable_metadata.hpp @@ -53,9 +53,9 @@ class DurableMetadata { bool PersistLabelPropertyIndexAndExistenceConstraintDeletion(LabelId label, PropertyId property, const std::string &key); - bool PersistTextIndexCreation(const std::string &index_name); + bool PersistTextIndexCreation(const std::string &index_name, LabelId label); - bool PersistTextIndexDeletion(const std::string &index_name); + bool PersistTextIndexDeletion(const std::string &index_name, LabelId label); bool PersistUniqueConstraintCreation(LabelId label, const std::set &properties); diff --git a/src/storage/v2/disk/storage.cpp b/src/storage/v2/disk/storage.cpp index ccdccf1a1..b880815c1 100644 --- a/src/storage/v2/disk/storage.cpp +++ b/src/storage/v2/disk/storage.cpp @@ -1657,12 +1657,14 @@ utils::BasicResult DiskStorage::DiskAccessor::Co throw utils::NotYetImplemented("ClearIndexStats(stats) is not implemented for DiskStorage."); } break; case MetadataDelta::Action::TEXT_INDEX_CREATE: { - if (!disk_storage->durable_metadata_.PersistTextIndexCreation(md_delta.text_indices.index_name)) { + const auto &info = md_delta.text_index; + if (!disk_storage->durable_metadata_.PersistTextIndexCreation(info.index_name, info.label)) { return StorageManipulationError{PersistenceError{}}; } } break; case MetadataDelta::Action::TEXT_INDEX_DROP: { - if (!disk_storage->durable_metadata_.PersistTextIndexDeletion(md_delta.text_indices.index_name)) { + const auto &info = md_delta.text_index; + if (!disk_storage->durable_metadata_.PersistTextIndexDeletion(info.index_name, info.label)) { return StorageManipulationError{PersistenceError{}}; } } break;