From 29eeb84ce3298876215591cbaa2037bb183b326c Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Mon, 13 Jan 2025 11:20:12 +0100 Subject: [PATCH] Add `--experimental-disable-vector-store` CLI flag --- crates/index-scheduler/src/features.rs | 9 +++++++-- crates/meilisearch-types/src/features.rs | 1 + .../src/analytics/segment_analytics.rs | 5 +++-- crates/meilisearch/src/option.rs | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/crates/index-scheduler/src/features.rs b/crates/index-scheduler/src/features.rs index 15a53ff17..3d123bd86 100644 --- a/crates/index-scheduler/src/features.rs +++ b/crates/index-scheduler/src/features.rs @@ -105,12 +105,17 @@ impl FeatureData { let txn = env.read_txn()?; let persisted_features: RuntimeTogglableFeatures = runtime_features_db.get(&txn, EXPERIMENTAL_FEATURES)?.unwrap_or_default(); - let InstanceTogglableFeatures { metrics, logs_route, contains_filter } = instance_features; + let InstanceTogglableFeatures { + metrics, + logs_route, + contains_filter, + disable_vector_store, + } = instance_features; let runtime = Arc::new(RwLock::new(RuntimeTogglableFeatures { metrics: metrics || persisted_features.metrics, logs_route: logs_route || persisted_features.logs_route, contains_filter: contains_filter || persisted_features.contains_filter, - vector_store: true, + vector_store: !disable_vector_store, ..persisted_features })); diff --git a/crates/meilisearch-types/src/features.rs b/crates/meilisearch-types/src/features.rs index b9805a124..be2b66cc0 100644 --- a/crates/meilisearch-types/src/features.rs +++ b/crates/meilisearch-types/src/features.rs @@ -15,4 +15,5 @@ pub struct InstanceTogglableFeatures { pub metrics: bool, pub logs_route: bool, pub contains_filter: bool, + pub disable_vector_store: bool, } diff --git a/crates/meilisearch/src/analytics/segment_analytics.rs b/crates/meilisearch/src/analytics/segment_analytics.rs index 646bff532..eb50fe29e 100644 --- a/crates/meilisearch/src/analytics/segment_analytics.rs +++ b/crates/meilisearch/src/analytics/segment_analytics.rs @@ -269,6 +269,7 @@ impl Infos { indexer_options, config_file_path, no_analytics: _, + experimental_disable_vector_store, } = options; let schedule_snapshot = match schedule_snapshot { @@ -280,7 +281,7 @@ impl Infos { indexer_options; let RuntimeTogglableFeatures { - vector_store, + vector_store: _, metrics, logs_route, edit_documents_by_function, @@ -292,7 +293,7 @@ impl Infos { Self { env, experimental_contains_filter: experimental_contains_filter | contains_filter, - experimental_vector_store: vector_store, + experimental_vector_store: !experimental_disable_vector_store, experimental_edit_documents_by_function: edit_documents_by_function, experimental_enable_metrics: experimental_enable_metrics | metrics, experimental_search_queue_size, diff --git a/crates/meilisearch/src/option.rs b/crates/meilisearch/src/option.rs index b5aa6b9e7..ae0e70f71 100644 --- a/crates/meilisearch/src/option.rs +++ b/crates/meilisearch/src/option.rs @@ -52,6 +52,7 @@ const MEILI_EXPERIMENTAL_LOGS_MODE: &str = "MEILI_EXPERIMENTAL_LOGS_MODE"; const MEILI_EXPERIMENTAL_REPLICATION_PARAMETERS: &str = "MEILI_EXPERIMENTAL_REPLICATION_PARAMETERS"; const MEILI_EXPERIMENTAL_ENABLE_LOGS_ROUTE: &str = "MEILI_EXPERIMENTAL_ENABLE_LOGS_ROUTE"; const MEILI_EXPERIMENTAL_CONTAINS_FILTER: &str = "MEILI_EXPERIMENTAL_CONTAINS_FILTER"; +const MEILI_EXPERIMENTAL_DISABLE_VECTOR_STORE: &str = "MEILI_EXPERIMENTAL_DISABLE_VECTOR_STORE"; const MEILI_EXPERIMENTAL_ENABLE_METRICS: &str = "MEILI_EXPERIMENTAL_ENABLE_METRICS"; const MEILI_EXPERIMENTAL_SEARCH_QUEUE_SIZE: &str = "MEILI_EXPERIMENTAL_SEARCH_QUEUE_SIZE"; const MEILI_EXPERIMENTAL_DROP_SEARCH_AFTER: &str = "MEILI_EXPERIMENTAL_DROP_SEARCH_AFTER"; @@ -360,6 +361,14 @@ pub struct Opt { #[serde(default)] pub experimental_enable_metrics: bool, + /// Experimental disabling of the vector store feature. For more information, + /// see: + /// + /// If set, disables embedder configuration, hybrid search, semantic search and similar requests. + #[clap(long, env = MEILI_EXPERIMENTAL_DISABLE_VECTOR_STORE)] + #[serde(default)] + pub experimental_disable_vector_store: bool, + /// Experimental search queue size. For more information, /// see: /// @@ -540,6 +549,7 @@ impl Opt { experimental_reduce_indexing_memory_usage, experimental_max_number_of_batched_tasks, experimental_limit_batched_tasks_total_size, + experimental_disable_vector_store, } = self; export_to_env_if_not_present(MEILI_DB_PATH, db_path); export_to_env_if_not_present(MEILI_HTTP_ADDR, http_addr); @@ -588,6 +598,10 @@ impl Opt { MEILI_EXPERIMENTAL_CONTAINS_FILTER, experimental_contains_filter.to_string(), ); + export_to_env_if_not_present( + MEILI_EXPERIMENTAL_DISABLE_VECTOR_STORE, + experimental_disable_vector_store.to_string(), + ); export_to_env_if_not_present( MEILI_EXPERIMENTAL_ENABLE_METRICS, experimental_enable_metrics.to_string(), @@ -680,6 +694,7 @@ impl Opt { metrics: self.experimental_enable_metrics, logs_route: self.experimental_enable_logs_route, contains_filter: self.experimental_contains_filter, + disable_vector_store: self.experimental_disable_vector_store, } } }