From 7f7fafb8579d52aa3ae954d44395e115c093ffb0 Mon Sep 17 00:00:00 2001 From: many Date: Thu, 2 Sep 2021 15:25:39 +0200 Subject: [PATCH] Make document_chunk_size settable from update builder --- milli/src/update/index_documents/mod.rs | 1 + milli/src/update/settings.rs | 3 +++ milli/src/update/update_builder.rs | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/milli/src/update/index_documents/mod.rs b/milli/src/update/index_documents/mod.rs index b27f2042f..e4c798163 100644 --- a/milli/src/update/index_documents/mod.rs +++ b/milli/src/update/index_documents/mod.rs @@ -281,6 +281,7 @@ impl<'t, 'u, 'i, 'a> IndexDocuments<'t, 'u, 'i, 'a> { log_every_n: self.log_every_n, max_nb_chunks: self.max_nb_chunks, max_memory: self.max_memory, + documents_chunk_size: self.documents_chunk_size, chunk_compression_type: self.chunk_compression_type, chunk_compression_level: self.chunk_compression_level, thread_pool: self.thread_pool, diff --git a/milli/src/update/settings.rs b/milli/src/update/settings.rs index ef23286ae..f1b3e2628 100644 --- a/milli/src/update/settings.rs +++ b/milli/src/update/settings.rs @@ -65,6 +65,7 @@ pub struct Settings<'a, 't, 'u, 'i> { pub(crate) log_every_n: Option, pub(crate) max_nb_chunks: Option, pub(crate) max_memory: Option, + pub(crate) documents_chunk_size: Option, pub(crate) chunk_compression_type: CompressionType, pub(crate) chunk_compression_level: Option, pub(crate) thread_pool: Option<&'a ThreadPool>, @@ -93,6 +94,7 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> { log_every_n: None, max_nb_chunks: None, max_memory: None, + documents_chunk_size: None, chunk_compression_type: CompressionType::None, chunk_compression_level: None, thread_pool: None, @@ -227,6 +229,7 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> { indexing_builder.log_every_n = self.log_every_n; indexing_builder.max_nb_chunks = self.max_nb_chunks; indexing_builder.max_memory = self.max_memory; + indexing_builder.documents_chunk_size = self.documents_chunk_size; indexing_builder.chunk_compression_type = self.chunk_compression_type; indexing_builder.chunk_compression_level = self.chunk_compression_level; indexing_builder.thread_pool = self.thread_pool; diff --git a/milli/src/update/update_builder.rs b/milli/src/update/update_builder.rs index 6035499b3..561c4bc50 100644 --- a/milli/src/update/update_builder.rs +++ b/milli/src/update/update_builder.rs @@ -7,6 +7,7 @@ use crate::{Index, Result}; pub struct UpdateBuilder<'a> { pub(crate) log_every_n: Option, pub(crate) max_nb_chunks: Option, + pub(crate) documents_chunk_size: Option, pub(crate) max_memory: Option, pub(crate) chunk_compression_type: CompressionType, pub(crate) chunk_compression_level: Option, @@ -19,6 +20,7 @@ impl<'a> UpdateBuilder<'a> { UpdateBuilder { log_every_n: None, max_nb_chunks: None, + documents_chunk_size: None, max_memory: None, chunk_compression_type: CompressionType::None, chunk_compression_level: None, @@ -39,6 +41,10 @@ impl<'a> UpdateBuilder<'a> { self.max_memory = Some(max_memory); } + pub fn documents_chunk_size(&mut self, documents_chunk_size: usize) { + self.documents_chunk_size = Some(documents_chunk_size); + } + pub fn chunk_compression_type(&mut self, chunk_compression_type: CompressionType) { self.chunk_compression_type = chunk_compression_type; } @@ -77,6 +83,7 @@ impl<'a> UpdateBuilder<'a> { builder.log_every_n = self.log_every_n; builder.max_nb_chunks = self.max_nb_chunks; builder.max_memory = self.max_memory; + builder.documents_chunk_size = self.documents_chunk_size; builder.chunk_compression_type = self.chunk_compression_type; builder.chunk_compression_level = self.chunk_compression_level; builder.thread_pool = self.thread_pool; @@ -94,6 +101,7 @@ impl<'a> UpdateBuilder<'a> { builder.log_every_n = self.log_every_n; builder.max_nb_chunks = self.max_nb_chunks; builder.max_memory = self.max_memory; + builder.documents_chunk_size = self.documents_chunk_size; builder.chunk_compression_type = self.chunk_compression_type; builder.chunk_compression_level = self.chunk_compression_level; builder.thread_pool = self.thread_pool;