Expose the WordsPrefixes update on the UpdateBuilder

This commit is contained in:
Clément Renault 2021-02-18 18:33:25 +01:00
parent 3090751dfc
commit c318373b88
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -2,7 +2,7 @@ use grenad::CompressionType;
use rayon::ThreadPool; use rayon::ThreadPool;
use crate::Index; use crate::Index;
use super::{ClearDocuments, DeleteDocuments, IndexDocuments, Settings, Facets}; use super::{ClearDocuments, DeleteDocuments, IndexDocuments, Settings, Facets, WordsPrefixes};
pub struct UpdateBuilder<'a> { pub struct UpdateBuilder<'a> {
pub(crate) log_every_n: Option<usize>, pub(crate) log_every_n: Option<usize>,
@ -135,4 +135,19 @@ impl<'a> UpdateBuilder<'a> {
builder builder
} }
pub fn words_prefixes<'t, 'u, 'i>(
self,
wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index,
) -> WordsPrefixes<'t, 'u, 'i>
{
let mut builder = WordsPrefixes::new(wtxn, index, self.update_id);
builder.chunk_compression_type = self.chunk_compression_type;
builder.chunk_compression_level = self.chunk_compression_level;
builder.chunk_fusing_shrink_size = self.chunk_fusing_shrink_size;
builder
}
} }