mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
Merge #440
440: fix(fuzzer): fix the fuzzer after #430 r=Kerollmops a=irevoire Co-authored-by: Tamo <tamo@meilisearch.com>
This commit is contained in:
commit
e1cc025cbd
@ -8,7 +8,7 @@ use arbitrary_json::ArbitraryValue;
|
|||||||
use heed::EnvOpenOptions;
|
use heed::EnvOpenOptions;
|
||||||
use libfuzzer_sys::fuzz_target;
|
use libfuzzer_sys::fuzz_target;
|
||||||
use milli::documents::{DocumentBatchBuilder, DocumentBatchReader};
|
use milli::documents::{DocumentBatchBuilder, DocumentBatchReader};
|
||||||
use milli::update::UpdateBuilder;
|
use milli::update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig, Settings};
|
||||||
use milli::Index;
|
use milli::Index;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
@ -35,11 +35,14 @@ fn index_documents(
|
|||||||
index: &mut milli::Index,
|
index: &mut milli::Index,
|
||||||
documents: DocumentBatchReader<Cursor<Vec<u8>>>,
|
documents: DocumentBatchReader<Cursor<Vec<u8>>>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let update_builder = UpdateBuilder::new();
|
let config = IndexerConfig::default();
|
||||||
let mut wtxn = index.write_txn()?;
|
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()?;
|
wtxn.commit()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -51,9 +54,10 @@ fn create_index() -> Result<milli::Index> {
|
|||||||
options.max_readers(1);
|
options.max_readers(1);
|
||||||
let index = Index::new(options, dir.path())?;
|
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 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 =
|
let displayed_fields =
|
||||||
["id", "title", "album", "artist", "genre", "country", "released", "duration"]
|
["id", "title", "album", "artist", "genre", "country", "released", "duration"]
|
||||||
|
Loading…
Reference in New Issue
Block a user