Make document_chunk_size settable from update builder

This commit is contained in:
many 2021-09-02 15:25:39 +02:00
parent db0c681bae
commit 7f7fafb857
No known key found for this signature in database
GPG Key ID: 2CEF23B75189EACA
3 changed files with 12 additions and 0 deletions

View File

@ -281,6 +281,7 @@ impl<'t, 'u, 'i, 'a> IndexDocuments<'t, 'u, 'i, 'a> {
log_every_n: self.log_every_n, log_every_n: self.log_every_n,
max_nb_chunks: self.max_nb_chunks, max_nb_chunks: self.max_nb_chunks,
max_memory: self.max_memory, max_memory: self.max_memory,
documents_chunk_size: self.documents_chunk_size,
chunk_compression_type: self.chunk_compression_type, chunk_compression_type: self.chunk_compression_type,
chunk_compression_level: self.chunk_compression_level, chunk_compression_level: self.chunk_compression_level,
thread_pool: self.thread_pool, thread_pool: self.thread_pool,

View File

@ -65,6 +65,7 @@ pub struct Settings<'a, 't, 'u, 'i> {
pub(crate) log_every_n: Option<usize>, pub(crate) log_every_n: Option<usize>,
pub(crate) max_nb_chunks: Option<usize>, pub(crate) max_nb_chunks: Option<usize>,
pub(crate) max_memory: Option<usize>, pub(crate) max_memory: Option<usize>,
pub(crate) documents_chunk_size: Option<usize>,
pub(crate) chunk_compression_type: CompressionType, pub(crate) chunk_compression_type: CompressionType,
pub(crate) chunk_compression_level: Option<u32>, pub(crate) chunk_compression_level: Option<u32>,
pub(crate) thread_pool: Option<&'a ThreadPool>, 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, log_every_n: None,
max_nb_chunks: None, max_nb_chunks: None,
max_memory: None, max_memory: None,
documents_chunk_size: None,
chunk_compression_type: CompressionType::None, chunk_compression_type: CompressionType::None,
chunk_compression_level: None, chunk_compression_level: None,
thread_pool: 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.log_every_n = self.log_every_n;
indexing_builder.max_nb_chunks = self.max_nb_chunks; indexing_builder.max_nb_chunks = self.max_nb_chunks;
indexing_builder.max_memory = self.max_memory; 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_type = self.chunk_compression_type;
indexing_builder.chunk_compression_level = self.chunk_compression_level; indexing_builder.chunk_compression_level = self.chunk_compression_level;
indexing_builder.thread_pool = self.thread_pool; indexing_builder.thread_pool = self.thread_pool;

View File

@ -7,6 +7,7 @@ use crate::{Index, Result};
pub struct UpdateBuilder<'a> { pub struct UpdateBuilder<'a> {
pub(crate) log_every_n: Option<usize>, pub(crate) log_every_n: Option<usize>,
pub(crate) max_nb_chunks: Option<usize>, pub(crate) max_nb_chunks: Option<usize>,
pub(crate) documents_chunk_size: Option<usize>,
pub(crate) max_memory: Option<usize>, pub(crate) max_memory: Option<usize>,
pub(crate) chunk_compression_type: CompressionType, pub(crate) chunk_compression_type: CompressionType,
pub(crate) chunk_compression_level: Option<u32>, pub(crate) chunk_compression_level: Option<u32>,
@ -19,6 +20,7 @@ impl<'a> UpdateBuilder<'a> {
UpdateBuilder { UpdateBuilder {
log_every_n: None, log_every_n: None,
max_nb_chunks: None, max_nb_chunks: None,
documents_chunk_size: None,
max_memory: None, max_memory: None,
chunk_compression_type: CompressionType::None, chunk_compression_type: CompressionType::None,
chunk_compression_level: None, chunk_compression_level: None,
@ -39,6 +41,10 @@ impl<'a> UpdateBuilder<'a> {
self.max_memory = Some(max_memory); 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) { pub fn chunk_compression_type(&mut self, chunk_compression_type: CompressionType) {
self.chunk_compression_type = chunk_compression_type; self.chunk_compression_type = chunk_compression_type;
} }
@ -77,6 +83,7 @@ impl<'a> UpdateBuilder<'a> {
builder.log_every_n = self.log_every_n; builder.log_every_n = self.log_every_n;
builder.max_nb_chunks = self.max_nb_chunks; builder.max_nb_chunks = self.max_nb_chunks;
builder.max_memory = self.max_memory; 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_type = self.chunk_compression_type;
builder.chunk_compression_level = self.chunk_compression_level; builder.chunk_compression_level = self.chunk_compression_level;
builder.thread_pool = self.thread_pool; builder.thread_pool = self.thread_pool;
@ -94,6 +101,7 @@ impl<'a> UpdateBuilder<'a> {
builder.log_every_n = self.log_every_n; builder.log_every_n = self.log_every_n;
builder.max_nb_chunks = self.max_nb_chunks; builder.max_nb_chunks = self.max_nb_chunks;
builder.max_memory = self.max_memory; 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_type = self.chunk_compression_type;
builder.chunk_compression_level = self.chunk_compression_level; builder.chunk_compression_level = self.chunk_compression_level;
builder.thread_pool = self.thread_pool; builder.thread_pool = self.thread_pool;