Rename the text search flag and set it to false by default
This commit is contained in:
parent
a6eb14f742
commit
6aa9e2a78b
@ -55,7 +55,7 @@ DEFINE_double(query_execution_timeout_sec, 600,
|
|||||||
DEFINE_bool(cartesian_product_enabled, true, "Enable cartesian product expansion.");
|
DEFINE_bool(cartesian_product_enabled, true, "Enable cartesian product expansion.");
|
||||||
|
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
DEFINE_bool(text_search_enabled, true, "Enable text search.");
|
DEFINE_bool(experimental_text_search_enabled, false, "Enable experimental text search.");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// Bolt server name
|
// Bolt server name
|
||||||
@ -76,14 +76,14 @@ constexpr auto kLogToStderrGFlagsKey = "also_log_to_stderr";
|
|||||||
constexpr auto kCartesianProductEnabledSettingKey = "cartesian-product-enabled";
|
constexpr auto kCartesianProductEnabledSettingKey = "cartesian-product-enabled";
|
||||||
constexpr auto kCartesianProductEnabledGFlagsKey = "cartesian-product-enabled";
|
constexpr auto kCartesianProductEnabledGFlagsKey = "cartesian-product-enabled";
|
||||||
|
|
||||||
constexpr auto kTextSearchEnabledSettingKey = "text-search-enabled";
|
constexpr auto kExperimentalTextSearchEnabledSettingKey = "experimental-text-search-enabled";
|
||||||
constexpr auto kTextSearchEnabledGFlagsKey = "text-search-enabled";
|
constexpr auto kExperimentalTextSearchEnabledGFlagsKey = "experimental-text-search-enabled";
|
||||||
|
|
||||||
// NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables)
|
// NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
// Local cache-like thing
|
// Local cache-like thing
|
||||||
std::atomic<double> execution_timeout_sec_;
|
std::atomic<double> execution_timeout_sec_;
|
||||||
std::atomic<bool> cartesian_product_enabled_{true};
|
std::atomic<bool> cartesian_product_enabled_{true};
|
||||||
std::atomic<bool> text_search_enabled_{true};
|
std::atomic<bool> experimental_text_search_enabled_{true};
|
||||||
// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables)
|
// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
|
|
||||||
auto ToLLEnum(std::string_view val) {
|
auto ToLLEnum(std::string_view val) {
|
||||||
@ -195,8 +195,8 @@ void Initialize() {
|
|||||||
[](const std::string &val) { cartesian_product_enabled_ = val == "true"; }, ValidBoolStr);
|
[](const std::string &val) { cartesian_product_enabled_ = val == "true"; }, ValidBoolStr);
|
||||||
|
|
||||||
register_flag(
|
register_flag(
|
||||||
kTextSearchEnabledGFlagsKey, kTextSearchEnabledSettingKey, !kRestore,
|
kExperimentalTextSearchEnabledGFlagsKey, kExperimentalTextSearchEnabledSettingKey, !kRestore,
|
||||||
[](const std::string &val) { text_search_enabled_ = val == "true"; }, ValidBoolStr);
|
[](const std::string &val) { experimental_text_search_enabled_ = val == "true"; }, ValidBoolStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetServerName() {
|
std::string GetServerName() {
|
||||||
@ -210,6 +210,6 @@ double GetExecutionTimeout() { return execution_timeout_sec_; }
|
|||||||
|
|
||||||
bool GetCartesianProductEnabled() { return cartesian_product_enabled_; }
|
bool GetCartesianProductEnabled() { return cartesian_product_enabled_; }
|
||||||
|
|
||||||
bool GetTextSearchEnabled() { return text_search_enabled_; }
|
bool GetExperimentalTextSearchEnabled() { return experimental_text_search_enabled_; }
|
||||||
|
|
||||||
} // namespace memgraph::flags::run_time
|
} // namespace memgraph::flags::run_time
|
||||||
|
@ -47,6 +47,6 @@ bool GetCartesianProductEnabled();
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
bool GetTextSearchEnabled();
|
bool GetExperimentalTextSearchEnabled();
|
||||||
|
|
||||||
} // namespace memgraph::flags::run_time
|
} // namespace memgraph::flags::run_time
|
||||||
|
@ -2532,7 +2532,7 @@ PreparedQuery PrepareIndexQuery(ParsedQuery parsed_query, bool in_explicit_trans
|
|||||||
if (index_type == IndexQuery::Type::LOOKUP) {
|
if (index_type == IndexQuery::Type::LOOKUP) {
|
||||||
maybe_index_error = properties.empty() ? dba->CreateIndex(label) : dba->CreateIndex(label, properties[0]);
|
maybe_index_error = properties.empty() ? dba->CreateIndex(label) : dba->CreateIndex(label, properties[0]);
|
||||||
} else if (index_type == IndexQuery::Type::TEXT) {
|
} else if (index_type == IndexQuery::Type::TEXT) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw QueryException("To use text indices, enable the text search feature.");
|
throw QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
maybe_index_error = dba->CreateTextIndex(index_name, label);
|
maybe_index_error = dba->CreateTextIndex(index_name, label);
|
||||||
@ -2562,7 +2562,7 @@ PreparedQuery PrepareIndexQuery(ParsedQuery parsed_query, bool in_explicit_trans
|
|||||||
if (index_type == IndexQuery::Type::LOOKUP) {
|
if (index_type == IndexQuery::Type::LOOKUP) {
|
||||||
maybe_index_error = properties.empty() ? dba->DropIndex(label) : dba->DropIndex(label, properties[0]);
|
maybe_index_error = properties.empty() ? dba->DropIndex(label) : dba->DropIndex(label, properties[0]);
|
||||||
} else if (index_type == IndexQuery::Type::TEXT) {
|
} else if (index_type == IndexQuery::Type::TEXT) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw QueryException("To use text indices, enable the text search feature.");
|
throw QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
maybe_index_error = dba->DropTextIndex(index_name);
|
maybe_index_error = dba->DropTextIndex(index_name);
|
||||||
|
@ -251,7 +251,7 @@ VertexAccessor &CreateLocalVertex(const NodeCreationInfo &node_info, Frame *fram
|
|||||||
}
|
}
|
||||||
MultiPropsInitChecked(&new_node, properties);
|
MultiPropsInitChecked(&new_node, properties);
|
||||||
|
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
context.db_accessor->TextIndexAddVertex(&new_node);
|
context.db_accessor->TextIndexAddVertex(&new_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2823,7 +2823,7 @@ bool SetProperty::SetPropertyCursor::Pull(Frame &frame, ExecutionContext &contex
|
|||||||
context.trigger_context_collector->RegisterSetObjectProperty(lhs.ValueVertex(), self_.property_,
|
context.trigger_context_collector->RegisterSetObjectProperty(lhs.ValueVertex(), self_.property_,
|
||||||
TypedValue{std::move(old_value)}, TypedValue{rhs});
|
TypedValue{std::move(old_value)}, TypedValue{rhs});
|
||||||
}
|
}
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
auto new_node = lhs.ValueVertex();
|
auto new_node = lhs.ValueVertex();
|
||||||
context.db_accessor->TextIndexUpdateVertex(&new_node);
|
context.db_accessor->TextIndexUpdateVertex(&new_node);
|
||||||
}
|
}
|
||||||
@ -2983,7 +2983,7 @@ void SetPropertiesOnRecord(TRecordAccessor *record, const TypedValue &rhs, SetPr
|
|||||||
case TypedValue::Type::Vertex: {
|
case TypedValue::Type::Vertex: {
|
||||||
PropertiesMap new_properties = get_props(rhs.ValueVertex());
|
PropertiesMap new_properties = get_props(rhs.ValueVertex());
|
||||||
update_props(new_properties);
|
update_props(new_properties);
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
auto new_node = rhs.ValueVertex();
|
auto new_node = rhs.ValueVertex();
|
||||||
context->db_accessor->TextIndexUpdateVertex(&new_node);
|
context->db_accessor->TextIndexUpdateVertex(&new_node);
|
||||||
}
|
}
|
||||||
@ -3134,7 +3134,7 @@ bool SetLabels::SetLabelsCursor::Pull(Frame &frame, ExecutionContext &context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
context.db_accessor->TextIndexUpdateVertex(&vertex);
|
context.db_accessor->TextIndexUpdateVertex(&vertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3209,7 +3209,7 @@ bool RemoveProperty::RemovePropertyCursor::Pull(Frame &frame, ExecutionContext &
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
remove_prop(&lhs.ValueVertex());
|
remove_prop(&lhs.ValueVertex());
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
auto &updated_vertex = lhs.ValueVertex();
|
auto &updated_vertex = lhs.ValueVertex();
|
||||||
context.db_accessor->TextIndexUpdateVertex(&updated_vertex);
|
context.db_accessor->TextIndexUpdateVertex(&updated_vertex);
|
||||||
}
|
}
|
||||||
@ -3303,7 +3303,7 @@ bool RemoveLabels::RemoveLabelsCursor::Pull(Frame &frame, ExecutionContext &cont
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
context.db_accessor->TextIndexUpdateVertex(&vertex, self_.labels_);
|
context.db_accessor->TextIndexUpdateVertex(&vertex, self_.labels_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1842,7 +1842,7 @@ mgp_error mgp_vertex_set_property(struct mgp_vertex *v, const char *property_nam
|
|||||||
const auto result = std::visit(
|
const auto result = std::visit(
|
||||||
[prop_key, property_value](auto &impl) {
|
[prop_key, property_value](auto &impl) {
|
||||||
return impl.SetProperty(prop_key, ToPropertyValue(*property_value),
|
return impl.SetProperty(prop_key, ToPropertyValue(*property_value),
|
||||||
memgraph::flags::run_time::GetTextSearchEnabled());
|
memgraph::flags::run_time::GetExperimentalTextSearchEnabled());
|
||||||
},
|
},
|
||||||
v->impl);
|
v->impl);
|
||||||
if (result.HasError()) {
|
if (result.HasError()) {
|
||||||
@ -1900,7 +1900,8 @@ mgp_error mgp_vertex_set_properties(struct mgp_vertex *v, struct mgp_map *proper
|
|||||||
v->graph->impl));
|
v->graph->impl));
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto result = v->getImpl().UpdateProperties(props, memgraph::flags::run_time::GetTextSearchEnabled());
|
const auto result =
|
||||||
|
v->getImpl().UpdateProperties(props, memgraph::flags::run_time::GetExperimentalTextSearchEnabled());
|
||||||
if (result.HasError()) {
|
if (result.HasError()) {
|
||||||
switch (result.GetError()) {
|
switch (result.GetError()) {
|
||||||
case memgraph::storage::Error::DELETED_OBJECT:
|
case memgraph::storage::Error::DELETED_OBJECT:
|
||||||
@ -1958,7 +1959,9 @@ mgp_error mgp_vertex_add_label(struct mgp_vertex *v, mgp_label label) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto result = std::visit(
|
const auto result = std::visit(
|
||||||
[label_id](auto &impl) { return impl.AddLabel(label_id, memgraph::flags::run_time::GetTextSearchEnabled()); },
|
[label_id](auto &impl) {
|
||||||
|
return impl.AddLabel(label_id, memgraph::flags::run_time::GetExperimentalTextSearchEnabled());
|
||||||
|
},
|
||||||
v->impl);
|
v->impl);
|
||||||
|
|
||||||
if (result.HasError()) {
|
if (result.HasError()) {
|
||||||
@ -2003,7 +2006,7 @@ mgp_error mgp_vertex_remove_label(struct mgp_vertex *v, mgp_label label) {
|
|||||||
}
|
}
|
||||||
const auto result = std::visit(
|
const auto result = std::visit(
|
||||||
[label_id](auto &impl) {
|
[label_id](auto &impl) {
|
||||||
return impl.RemoveLabel(label_id, memgraph::flags::run_time::GetTextSearchEnabled());
|
return impl.RemoveLabel(label_id, memgraph::flags::run_time::GetExperimentalTextSearchEnabled());
|
||||||
},
|
},
|
||||||
v->impl);
|
v->impl);
|
||||||
|
|
||||||
|
@ -1764,7 +1764,7 @@ utils::BasicResult<StorageManipulationError, void> DiskStorage::DiskAccessor::Co
|
|||||||
return StorageManipulationError{SerializationError{}};
|
return StorageManipulationError{SerializationError{}};
|
||||||
}
|
}
|
||||||
spdlog::trace("rocksdb: Commit successful");
|
spdlog::trace("rocksdb: Commit successful");
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
disk_storage->indices_.text_index_->Commit();
|
disk_storage->indices_.text_index_->Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1885,7 +1885,7 @@ void DiskStorage::DiskAccessor::Abort() {
|
|||||||
// query_plan_accumulate_aggregate.cpp
|
// query_plan_accumulate_aggregate.cpp
|
||||||
transaction_.disk_transaction_->Rollback();
|
transaction_.disk_transaction_->Rollback();
|
||||||
transaction_.disk_transaction_->ClearSnapshot();
|
transaction_.disk_transaction_->ClearSnapshot();
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
storage_->indices_.text_index_->Rollback();
|
storage_->indices_.text_index_->Rollback();
|
||||||
}
|
}
|
||||||
delete transaction_.disk_transaction_;
|
delete transaction_.disk_transaction_;
|
||||||
|
@ -197,7 +197,7 @@ void RecoverIndicesAndStats(const RecoveredIndicesAndConstraints::IndicesMetadat
|
|||||||
}
|
}
|
||||||
spdlog::info("Label+property indices statistics are recreated.");
|
spdlog::info("Label+property indices statistics are recreated.");
|
||||||
|
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
// Recover text indices.
|
// Recover text indices.
|
||||||
spdlog::info("Recreating {} text indices from metadata.", indices_metadata.text.size());
|
spdlog::info("Recreating {} text indices from metadata.", indices_metadata.text.size());
|
||||||
auto *mem_text_index = static_cast<TextIndex *>(indices->text_index_.get());
|
auto *mem_text_index = static_cast<TextIndex *>(indices->text_index_.get());
|
||||||
|
@ -1631,7 +1631,7 @@ RecoveredSnapshot LoadSnapshot(const std::filesystem::path &path, utils::SkipLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Recover text indices.
|
// Recover text indices.
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
auto size = snapshot.ReadUint();
|
auto size = snapshot.ReadUint();
|
||||||
if (!size) throw RecoveryFailure("Couldn't recover the number of text indices!");
|
if (!size) throw RecoveryFailure("Couldn't recover the number of text indices!");
|
||||||
spdlog::info("Recovering metadata of {} text indices.", *size);
|
spdlog::info("Recovering metadata of {} text indices.", *size);
|
||||||
@ -2126,7 +2126,7 @@ void CreateSnapshot(Storage *storage, Transaction *transaction, const std::files
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write text indices.
|
// Write text indices.
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
auto text = storage->indices_.text_index_->ListIndices();
|
auto text = storage->indices_.text_index_->ListIndices();
|
||||||
snapshot.WriteUint(text.size());
|
snapshot.WriteUint(text.size());
|
||||||
for (const auto &item : text) {
|
for (const auto &item : text) {
|
||||||
|
@ -19,7 +19,7 @@ namespace memgraph::storage {
|
|||||||
|
|
||||||
void TextIndex::AddNode(Vertex *vertex_after_update, Storage *storage, const std::uint64_t transaction_start_timestamp,
|
void TextIndex::AddNode(Vertex *vertex_after_update, Storage *storage, const std::uint64_t transaction_start_timestamp,
|
||||||
const std::vector<mgcxx::text_search::Context *> &applicable_text_indices, bool skip_commit) {
|
const std::vector<mgcxx::text_search::Context *> &applicable_text_indices, bool skip_commit) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ void TextIndex::AddNode(Vertex *vertex_after_update, Storage *storage, const std
|
|||||||
|
|
||||||
void TextIndex::AddNode(Vertex *vertex_after_update, Storage *storage,
|
void TextIndex::AddNode(Vertex *vertex_after_update, Storage *storage,
|
||||||
const std::uint64_t transaction_start_timestamp) {
|
const std::uint64_t transaction_start_timestamp) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ void TextIndex::AddNode(Vertex *vertex_after_update, Storage *storage,
|
|||||||
|
|
||||||
void TextIndex::UpdateNode(Vertex *vertex_after_update, Storage *storage,
|
void TextIndex::UpdateNode(Vertex *vertex_after_update, Storage *storage,
|
||||||
const std::uint64_t transaction_start_timestamp) {
|
const std::uint64_t transaction_start_timestamp) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ void TextIndex::UpdateNode(Vertex *vertex_after_update, Storage *storage,
|
|||||||
void TextIndex::UpdateNode(Vertex *vertex_after_update, Storage *storage,
|
void TextIndex::UpdateNode(Vertex *vertex_after_update, Storage *storage,
|
||||||
const std::uint64_t transaction_start_timestamp,
|
const std::uint64_t transaction_start_timestamp,
|
||||||
const std::vector<LabelId> &removed_labels) {
|
const std::vector<LabelId> &removed_labels) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ void TextIndex::UpdateNode(Vertex *vertex_after_update, Storage *storage,
|
|||||||
|
|
||||||
void TextIndex::RemoveNode(Vertex *vertex_after_update,
|
void TextIndex::RemoveNode(Vertex *vertex_after_update,
|
||||||
const std::vector<mgcxx::text_search::Context *> &applicable_text_indices) {
|
const std::vector<mgcxx::text_search::Context *> &applicable_text_indices) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ void TextIndex::RemoveNode(Vertex *vertex_after_update,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TextIndex::RemoveNode(Vertex *vertex_after_update) {
|
void TextIndex::RemoveNode(Vertex *vertex_after_update) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ void TextIndex::RemoveNode(Vertex *vertex_after_update) {
|
|||||||
|
|
||||||
void TextIndex::UpdateOnAddLabel(LabelId added_label, Vertex *vertex_after_update, Storage *storage,
|
void TextIndex::UpdateOnAddLabel(LabelId added_label, Vertex *vertex_after_update, Storage *storage,
|
||||||
const std::uint64_t transaction_start_timestamp) {
|
const std::uint64_t transaction_start_timestamp) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ void TextIndex::UpdateOnAddLabel(LabelId added_label, Vertex *vertex_after_updat
|
|||||||
|
|
||||||
void TextIndex::UpdateOnRemoveLabel(LabelId removed_label, Vertex *vertex_after_update,
|
void TextIndex::UpdateOnRemoveLabel(LabelId removed_label, Vertex *vertex_after_update,
|
||||||
const std::uint64_t transaction_start_timestamp) {
|
const std::uint64_t transaction_start_timestamp) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ void TextIndex::UpdateOnRemoveLabel(LabelId removed_label, Vertex *vertex_after_
|
|||||||
|
|
||||||
void TextIndex::UpdateOnSetProperty(Vertex *vertex_after_update, Storage *storage,
|
void TextIndex::UpdateOnSetProperty(Vertex *vertex_after_update, Storage *storage,
|
||||||
std::uint64_t transaction_start_timestamp) {
|
std::uint64_t transaction_start_timestamp) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ void TextIndex::UpdateOnSetProperty(Vertex *vertex_after_update, Storage *storag
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<mgcxx::text_search::Context *> TextIndex::GetApplicableTextIndices(const std::vector<LabelId> &labels) {
|
std::vector<mgcxx::text_search::Context *> TextIndex::GetApplicableTextIndices(const std::vector<LabelId> &labels) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ std::vector<mgcxx::text_search::Context *> TextIndex::GetApplicableTextIndices(c
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<mgcxx::text_search::Context *> TextIndex::GetApplicableTextIndices(Vertex *vertex) {
|
std::vector<mgcxx::text_search::Context *> TextIndex::GetApplicableTextIndices(Vertex *vertex) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ std::vector<mgcxx::text_search::Context *> TextIndex::GetApplicableTextIndices(V
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TextIndex::CreateIndex(std::string index_name, LabelId label, memgraph::query::DbAccessor *db) {
|
bool TextIndex::CreateIndex(std::string index_name, LabelId label, memgraph::query::DbAccessor *db) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ bool TextIndex::CreateIndex(std::string index_name, LabelId label, memgraph::que
|
|||||||
|
|
||||||
bool TextIndex::RecoverIndex(std::string index_name, LabelId label,
|
bool TextIndex::RecoverIndex(std::string index_name, LabelId label,
|
||||||
memgraph::utils::SkipList<Vertex>::Accessor vertices, NameIdMapper *name_id_mapper) {
|
memgraph::utils::SkipList<Vertex>::Accessor vertices, NameIdMapper *name_id_mapper) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +392,7 @@ bool TextIndex::RecoverIndex(std::string index_name, LabelId label,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TextIndex::DropIndex(std::string index_name) {
|
bool TextIndex::DropIndex(std::string index_name) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ bool TextIndex::DropIndex(std::string index_name) {
|
|||||||
bool TextIndex::IndexExists(std::string index_name) const { return index_.contains(index_name); }
|
bool TextIndex::IndexExists(std::string index_name) const { return index_.contains(index_name); }
|
||||||
|
|
||||||
std::vector<Gid> TextIndex::Search(std::string index_name, std::string search_query) {
|
std::vector<Gid> TextIndex::Search(std::string index_name, std::string search_query) {
|
||||||
if (!flags::run_time::GetTextSearchEnabled()) {
|
if (!flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
throw query::QueryException("To use text indices, enable the text search feature.");
|
throw query::QueryException("To use text indices, enable the text search feature.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,7 +864,7 @@ utils::BasicResult<StorageManipulationError, void> InMemoryStorage::InMemoryAcce
|
|||||||
return StorageManipulationError{*unique_constraint_violation};
|
return StorageManipulationError{*unique_constraint_violation};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
mem_storage->indices_.text_index_->Commit();
|
mem_storage->indices_.text_index_->Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1099,7 +1099,7 @@ void InMemoryStorage::InMemoryAccessor::Abort() {
|
|||||||
for (auto const &[property, prop_vertices] : property_cleanup) {
|
for (auto const &[property, prop_vertices] : property_cleanup) {
|
||||||
storage_->indices_.AbortEntries(property, prop_vertices, transaction_.start_timestamp);
|
storage_->indices_.AbortEntries(property, prop_vertices, transaction_.start_timestamp);
|
||||||
}
|
}
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
storage_->indices_.text_index_->Rollback();
|
storage_->indices_.text_index_->Rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ Result<std::optional<VertexAccessor>> Storage::Accessor::DeleteVertex(VertexAcce
|
|||||||
return res.GetError();
|
return res.GetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
storage_->indices_.text_index_->RemoveNode(vertex->vertex_);
|
storage_->indices_.text_index_->RemoveNode(vertex->vertex_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ Result<std::optional<std::pair<VertexAccessor, std::vector<EdgeAccessor>>>> Stor
|
|||||||
return res.GetError();
|
return res.GetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
storage_->indices_.text_index_->RemoveNode(vertex->vertex_);
|
storage_->indices_.text_index_->RemoveNode(vertex->vertex_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ Storage::Accessor::DetachDelete(std::vector<VertexAccessor *> nodes, std::vector
|
|||||||
return maybe_deleted_vertices.GetError();
|
return maybe_deleted_vertices.GetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags::run_time::GetTextSearchEnabled()) {
|
if (flags::run_time::GetExperimentalTextSearchEnabled()) {
|
||||||
for (auto *node : nodes_to_delete) {
|
for (auto *node : nodes_to_delete) {
|
||||||
storage_->indices_.text_index_->RemoveNode(node);
|
storage_->indices_.text_index_->RemoveNode(node);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
text_search_cluster: &text_search_cluster
|
text_search_cluster: &text_search_cluster
|
||||||
cluster:
|
cluster:
|
||||||
main:
|
main:
|
||||||
args: ["--bolt-port", "7687", "--log-level=TRACE"]
|
args: ["--bolt-port", "7687", "--log-level=TRACE", "--experimental-text-search-enabled=true"]
|
||||||
log_file: "text_search.log"
|
log_file: "text_search.log"
|
||||||
setup_queries: []
|
setup_queries: []
|
||||||
validation_queries: []
|
validation_queries: []
|
||||||
|
Loading…
Reference in New Issue
Block a user