Change format of update file when importing dump

This commit is contained in:
ManyTheFish 2025-01-16 18:05:29 +01:00 committed by Louis Dureuil
parent 1cadab9ad8
commit cea0c89212
No known key found for this signature in database
2 changed files with 8 additions and 5 deletions

View File

@ -29,7 +29,7 @@ use bumpalo::Bump;
use dump::IndexMetadata; use dump::IndexMetadata;
use meilisearch_types::batches::BatchId; use meilisearch_types::batches::BatchId;
use meilisearch_types::heed::{RoTxn, RwTxn}; use meilisearch_types::heed::{RoTxn, RwTxn};
use meilisearch_types::milli::documents::{obkv_to_object, DocumentsBatchReader, PrimaryKey}; use meilisearch_types::milli::documents::PrimaryKey;
use meilisearch_types::milli::heed::CompactionOption; use meilisearch_types::milli::heed::CompactionOption;
use meilisearch_types::milli::progress::Progress; use meilisearch_types::milli::progress::Progress;
use meilisearch_types::milli::update::new::indexer::{self, UpdateByFunction}; use meilisearch_types::milli::update::new::indexer::{self, UpdateByFunction};

View File

@ -2024,12 +2024,15 @@ impl<'a> Dump<'a> {
let content_uuid = match content_file { let content_uuid = match content_file {
Some(content_file) if task.status == Status::Enqueued => { Some(content_file) if task.status == Status::Enqueued => {
let (uuid, mut file) = self.index_scheduler.create_update_file(false)?; let (uuid, file) = self.index_scheduler.create_update_file(false)?;
let mut builder = DocumentsBatchBuilder::new(&mut file); let mut writer = io::BufWriter::new(file);
for doc in content_file { for doc in content_file {
builder.append_json_object(&doc?)?; let doc = doc?;
serde_json::to_writer(&mut writer, &doc).map_err(|e| {
Error::from_milli(milli::InternalError::SerdeJson(e).into(), None)
})?;
} }
builder.into_inner()?; let file = writer.into_inner().map_err(|e| e.into_error())?;
file.persist()?; file.persist()?;
Some(uuid) Some(uuid)