From b3a11e04afb849082ab9c1b734070b209e6eb07a Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Tue, 22 Mar 2022 16:38:52 +0100 Subject: [PATCH] Implement Default on IndexerOpts again --- meilisearch-lib/src/options.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/meilisearch-lib/src/options.rs b/meilisearch-lib/src/options.rs index 12f0c0a12..ef91ce695 100644 --- a/meilisearch-lib/src/options.rs +++ b/meilisearch-lib/src/options.rs @@ -69,7 +69,7 @@ impl TryFrom<&IndexerOpts> for IndexerConfig { Ok(Self { log_every_n: Some(other.log_every_n), max_nb_chunks: other.max_nb_chunks, - max_memory: (*other.max_memory).map(|b| b.get_bytes() as usize), + max_memory: other.max_memory.map(|b| b.get_bytes() as usize), thread_pool: Some(thread_pool), max_positions_per_attributes: None, ..Default::default() @@ -77,6 +77,17 @@ impl TryFrom<&IndexerOpts> for IndexerConfig { } } +impl Default for IndexerOpts { + fn default() -> Self { + Self { + log_every_n: 100_000, + max_nb_chunks: None, + max_memory: MaxMemory::default(), + indexing_jobs: None, + } + } +} + /// A type used to detect the max memory available and use 2/3 of it. #[derive(Debug, Clone, Copy)] pub struct MaxMemory(Option);