mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
Transform experimental_no_edition_2024_for_settings into a config
This commit is contained in:
parent
6db5939f84
commit
6b2b8ed676
5 changed files with 39 additions and 5 deletions
|
@ -202,6 +202,7 @@ struct Infos {
|
||||||
experimental_composite_embedders: bool,
|
experimental_composite_embedders: bool,
|
||||||
experimental_embedding_cache_entries: usize,
|
experimental_embedding_cache_entries: usize,
|
||||||
experimental_no_snapshot_compaction: bool,
|
experimental_no_snapshot_compaction: bool,
|
||||||
|
experimental_no_edition_2024_for_settings: bool,
|
||||||
gpu_enabled: bool,
|
gpu_enabled: bool,
|
||||||
db_path: bool,
|
db_path: bool,
|
||||||
import_dump: bool,
|
import_dump: bool,
|
||||||
|
@ -286,8 +287,12 @@ impl Infos {
|
||||||
ScheduleSnapshot::Enabled(interval) => Some(interval),
|
ScheduleSnapshot::Enabled(interval) => Some(interval),
|
||||||
};
|
};
|
||||||
|
|
||||||
let IndexerOpts { max_indexing_memory, max_indexing_threads, skip_index_budget: _ } =
|
let IndexerOpts {
|
||||||
indexer_options;
|
max_indexing_memory,
|
||||||
|
max_indexing_threads,
|
||||||
|
skip_index_budget: _,
|
||||||
|
experimental_no_edition_2024_for_settings,
|
||||||
|
} = indexer_options;
|
||||||
|
|
||||||
let RuntimeTogglableFeatures {
|
let RuntimeTogglableFeatures {
|
||||||
metrics,
|
metrics,
|
||||||
|
@ -350,6 +355,7 @@ impl Infos {
|
||||||
ssl_require_auth,
|
ssl_require_auth,
|
||||||
ssl_resumption,
|
ssl_resumption,
|
||||||
ssl_tickets,
|
ssl_tickets,
|
||||||
|
experimental_no_edition_2024_for_settings,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ const MEILI_EXPERIMENTAL_DUMPLESS_UPGRADE: &str = "MEILI_EXPERIMENTAL_DUMPLESS_U
|
||||||
const MEILI_EXPERIMENTAL_REPLICATION_PARAMETERS: &str = "MEILI_EXPERIMENTAL_REPLICATION_PARAMETERS";
|
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_ENABLE_LOGS_ROUTE: &str = "MEILI_EXPERIMENTAL_ENABLE_LOGS_ROUTE";
|
||||||
const MEILI_EXPERIMENTAL_CONTAINS_FILTER: &str = "MEILI_EXPERIMENTAL_CONTAINS_FILTER";
|
const MEILI_EXPERIMENTAL_CONTAINS_FILTER: &str = "MEILI_EXPERIMENTAL_CONTAINS_FILTER";
|
||||||
|
const MEILI_EXPERIMENTAL_NO_EDITION_2024_FOR_SETTINGS: &str =
|
||||||
|
"MEILI_EXPERIMENTAL_NO_EDITION_2024_FOR_SETTINGS";
|
||||||
const MEILI_EXPERIMENTAL_ENABLE_METRICS: &str = "MEILI_EXPERIMENTAL_ENABLE_METRICS";
|
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_SEARCH_QUEUE_SIZE: &str = "MEILI_EXPERIMENTAL_SEARCH_QUEUE_SIZE";
|
||||||
const MEILI_EXPERIMENTAL_DROP_SEARCH_AFTER: &str = "MEILI_EXPERIMENTAL_DROP_SEARCH_AFTER";
|
const MEILI_EXPERIMENTAL_DROP_SEARCH_AFTER: &str = "MEILI_EXPERIMENTAL_DROP_SEARCH_AFTER";
|
||||||
|
@ -749,12 +751,24 @@ pub struct IndexerOpts {
|
||||||
#[clap(skip)]
|
#[clap(skip)]
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub skip_index_budget: bool,
|
pub skip_index_budget: bool,
|
||||||
|
|
||||||
|
/// Experimental no edition 2024 for settings feature. For more information,
|
||||||
|
///
|
||||||
|
/// Enables the experimental no edition 2024 for settings feature.
|
||||||
|
#[clap(long, env = MEILI_EXPERIMENTAL_NO_EDITION_2024_FOR_SETTINGS)]
|
||||||
|
#[serde(default)]
|
||||||
|
pub experimental_no_edition_2024_for_settings: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IndexerOpts {
|
impl IndexerOpts {
|
||||||
/// Exports the values to their corresponding env vars if they are not set.
|
/// Exports the values to their corresponding env vars if they are not set.
|
||||||
pub fn export_to_env(self) {
|
pub fn export_to_env(self) {
|
||||||
let IndexerOpts { max_indexing_memory, max_indexing_threads, skip_index_budget: _ } = self;
|
let IndexerOpts {
|
||||||
|
max_indexing_memory,
|
||||||
|
max_indexing_threads,
|
||||||
|
skip_index_budget: _,
|
||||||
|
experimental_no_edition_2024_for_settings,
|
||||||
|
} = self;
|
||||||
if let Some(max_indexing_memory) = max_indexing_memory.0 {
|
if let Some(max_indexing_memory) = max_indexing_memory.0 {
|
||||||
export_to_env_if_not_present(
|
export_to_env_if_not_present(
|
||||||
MEILI_MAX_INDEXING_MEMORY,
|
MEILI_MAX_INDEXING_MEMORY,
|
||||||
|
@ -767,6 +781,12 @@ impl IndexerOpts {
|
||||||
max_indexing_threads.to_string(),
|
max_indexing_threads.to_string(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if experimental_no_edition_2024_for_settings {
|
||||||
|
export_to_env_if_not_present(
|
||||||
|
MEILI_EXPERIMENTAL_NO_EDITION_2024_FOR_SETTINGS,
|
||||||
|
experimental_no_edition_2024_for_settings.to_string(),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,7 +805,12 @@ impl TryFrom<&IndexerOpts> for IndexerConfig {
|
||||||
max_threads: *other.max_indexing_threads,
|
max_threads: *other.max_indexing_threads,
|
||||||
max_positions_per_attributes: None,
|
max_positions_per_attributes: None,
|
||||||
skip_index_budget: other.skip_index_budget,
|
skip_index_budget: other.skip_index_budget,
|
||||||
..Default::default()
|
experimental_no_edition_2024_for_settings: other
|
||||||
|
.experimental_no_edition_2024_for_settings,
|
||||||
|
chunk_compression_type: Default::default(),
|
||||||
|
chunk_compression_level: Default::default(),
|
||||||
|
documents_chunk_size: Default::default(),
|
||||||
|
max_nb_chunks: Default::default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,6 +464,7 @@ pub fn default_settings(dir: impl AsRef<Path>) -> Opt {
|
||||||
skip_index_budget: true,
|
skip_index_budget: true,
|
||||||
// Having 2 threads makes the tests way faster
|
// Having 2 threads makes the tests way faster
|
||||||
max_indexing_threads: MaxThreads::from_str("2").unwrap(),
|
max_indexing_threads: MaxThreads::from_str("2").unwrap(),
|
||||||
|
experimental_no_edition_2024_for_settings: false,
|
||||||
},
|
},
|
||||||
experimental_enable_metrics: false,
|
experimental_enable_metrics: false,
|
||||||
..Parser::parse_from(None as Option<&str>)
|
..Parser::parse_from(None as Option<&str>)
|
||||||
|
|
|
@ -15,6 +15,7 @@ pub struct IndexerConfig {
|
||||||
pub thread_pool: ThreadPoolNoAbort,
|
pub thread_pool: ThreadPoolNoAbort,
|
||||||
pub max_positions_per_attributes: Option<u32>,
|
pub max_positions_per_attributes: Option<u32>,
|
||||||
pub skip_index_budget: bool,
|
pub skip_index_budget: bool,
|
||||||
|
pub experimental_no_edition_2024_for_settings: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IndexerConfig {
|
impl IndexerConfig {
|
||||||
|
@ -63,6 +64,7 @@ impl Default for IndexerConfig {
|
||||||
chunk_compression_level: None,
|
chunk_compression_level: None,
|
||||||
max_positions_per_attributes: None,
|
max_positions_per_attributes: None,
|
||||||
skip_index_budget: false,
|
skip_index_budget: false,
|
||||||
|
experimental_no_edition_2024_for_settings: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1441,7 +1441,7 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
||||||
MSP: Fn() -> bool + Sync,
|
MSP: Fn() -> bool + Sync,
|
||||||
{
|
{
|
||||||
// force the old indexer if the environment says so
|
// force the old indexer if the environment says so
|
||||||
if std::env::var_os("MEILI_EXPERIMENTAL_NO_EDITION_2024_FOR_SETTINGS").is_some() {
|
if self.indexer_config.experimental_no_edition_2024_for_settings {
|
||||||
return self
|
return self
|
||||||
.legacy_execute(
|
.legacy_execute(
|
||||||
|indexing_step| tracing::debug!(update = ?indexing_step),
|
|indexing_step| tracing::debug!(update = ?indexing_step),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue