From fb51d511be18f103851d9d2e72bb8a2a5b7bc387 Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 25 Jan 2022 12:08:47 +0100 Subject: [PATCH] fix(fuzzer): fix the fuzzer after #430 --- milli/fuzz/fuzz_targets/indexing.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/milli/fuzz/fuzz_targets/indexing.rs b/milli/fuzz/fuzz_targets/indexing.rs index 327df09d1..fc51f969a 100644 --- a/milli/fuzz/fuzz_targets/indexing.rs +++ b/milli/fuzz/fuzz_targets/indexing.rs @@ -8,7 +8,7 @@ use arbitrary_json::ArbitraryValue; use heed::EnvOpenOptions; use libfuzzer_sys::fuzz_target; use milli::documents::{DocumentBatchBuilder, DocumentBatchReader}; -use milli::update::UpdateBuilder; +use milli::update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig, Settings}; use milli::Index; use serde_json::Value; @@ -35,11 +35,14 @@ fn index_documents( index: &mut milli::Index, documents: DocumentBatchReader>>, ) -> Result<()> { - let update_builder = UpdateBuilder::new(); + let config = IndexerConfig::default(); let mut wtxn = index.write_txn()?; - let builder = update_builder.index_documents(&mut wtxn, &index); - builder.execute(documents, |_| ())?; + let indexing_config = IndexDocumentsConfig::default(); + let mut builder = IndexDocuments::new(&mut wtxn, &index, &config, indexing_config, |_| ()); + builder.add_documents(documents)?; + builder.execute().unwrap(); + wtxn.commit()?; Ok(()) } @@ -51,9 +54,10 @@ fn create_index() -> Result { options.max_readers(1); let index = Index::new(options, dir.path())?; - let update_builder = UpdateBuilder::new(); + let config = IndexerConfig::default(); let mut wtxn = index.write_txn().unwrap(); - let mut builder = update_builder.settings(&mut wtxn, &index); + + let mut builder = Settings::new(&mut wtxn, &index, &config); let displayed_fields = ["id", "title", "album", "artist", "genre", "country", "released", "duration"]