Add text-search-enabled flag

This commit is contained in:
Ante Pušić 2024-01-08 01:25:56 +01:00
parent 5b22a7d3a4
commit 584d86e774
2 changed files with 23 additions and 6 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2023 Memgraph Ltd.
// Copyright 2024 Memgraph Ltd.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
@ -73,11 +73,15 @@ constexpr auto kLogToStderrGFlagsKey = "also_log_to_stderr";
constexpr auto kCartesianProductEnabledSettingKey = "cartesian-product-enabled";
constexpr auto kCartesianProductEnabledGFlagsKey = "cartesian-product-enabled";
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
std::atomic<double> execution_timeout_sec_; // Local cache-like thing
constexpr auto kTextSearchEnabledSettingKey = "text-search-enabled";
constexpr auto kTextSearchEnabledGFlagsKey = "text-search-enabled";
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
std::atomic<bool> cartesian_product_enabled_{true}; // Local cache-like thing
// NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables)
// Local cache-like thing
std::atomic<double> execution_timeout_sec_;
std::atomic<bool> cartesian_product_enabled_{true};
std::atomic<bool> text_search_enabled_{true};
// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables)
auto ToLLEnum(std::string_view val) {
const auto ll_enum = memgraph::flags::LogLevelToEnum(val);
@ -186,6 +190,10 @@ void Initialize() {
register_flag(
kCartesianProductEnabledGFlagsKey, kCartesianProductEnabledSettingKey, !kRestore,
[](const std::string &val) { cartesian_product_enabled_ = val == "true"; }, ValidBoolStr);
register_flag(
kTextSearchEnabledGFlagsKey, kTextSearchEnabledSettingKey, !kRestore,
[](const std::string &val) { text_search_enabled_ = val == "true"; }, ValidBoolStr);
}
std::string GetServerName() {
@ -199,4 +207,6 @@ double GetExecutionTimeout() { return execution_timeout_sec_; }
bool GetCartesianProductEnabled() { return cartesian_product_enabled_; }
bool GetTextSearchEnabled() { return text_search_enabled_; }
} // namespace memgraph::flags::run_time

View File

@ -1,4 +1,4 @@
// Copyright 2023 Memgraph Ltd.
// Copyright 2024 Memgraph Ltd.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
@ -42,4 +42,11 @@ double GetExecutionTimeout();
*/
bool GetCartesianProductEnabled();
/**
* @brief Get whether text search is enabled
*
* @return bool
*/
bool GetTextSearchEnabled();
} // namespace memgraph::flags::run_time