diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 3ad546eb4..1e551f9f8 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -1190,7 +1190,7 @@ mod tests { pub fn read_json( bytes: &[u8], write: impl Write + Seek, - ) -> std::result::Result { + ) -> std::result::Result { let temp_file = NamedTempFile::new().unwrap(); let mut buffer = BufWriter::new(temp_file.reopen().unwrap()); buffer.write_all(bytes).unwrap(); diff --git a/meilisearch-types/src/document_formats.rs b/meilisearch-types/src/document_formats.rs index f3b4d090f..dc9555fd9 100644 --- a/meilisearch-types/src/document_formats.rs +++ b/meilisearch-types/src/document_formats.rs @@ -101,7 +101,7 @@ impl ErrorCode for DocumentFormatError { internal_error!(DocumentFormatError: io::Error); /// Reads CSV from input and write an obkv batch to writer. -pub fn read_csv(file: &File, writer: impl Write + Seek) -> Result { +pub fn read_csv(file: &File, writer: impl Write + Seek) -> Result { let mut builder = DocumentsBatchBuilder::new(writer); let mmap = unsafe { MmapOptions::new().map(file)? }; let csv = csv::Reader::from_reader(mmap.as_ref()); @@ -110,16 +110,16 @@ pub fn read_csv(file: &File, writer: impl Write + Seek) -> Result { let count = builder.documents_count(); let _ = builder.into_inner().map_err(Into::into).map_err(DocumentFormatError::Internal)?; - Ok(count as usize) + Ok(count as u64) } /// Reads JSON from temporary file and write an obkv batch to writer. -pub fn read_json(file: &File, writer: impl Write + Seek) -> Result { +pub fn read_json(file: &File, writer: impl Write + Seek) -> Result { read_json_inner(file, writer, PayloadType::Json) } /// Reads JSON from temporary file and write an obkv batch to writer. -pub fn read_ndjson(file: &File, writer: impl Write + Seek) -> Result { +pub fn read_ndjson(file: &File, writer: impl Write + Seek) -> Result { read_json_inner(file, writer, PayloadType::Ndjson) } @@ -128,7 +128,7 @@ fn read_json_inner( file: &File, writer: impl Write + Seek, payload_type: PayloadType, -) -> Result { +) -> Result { let mut builder = DocumentsBatchBuilder::new(writer); let mmap = unsafe { MmapOptions::new().map(file)? }; let mut deserializer = serde_json::Deserializer::from_slice(&mmap); @@ -155,7 +155,7 @@ fn read_json_inner( let count = builder.documents_count(); let _ = builder.into_inner().map_err(Into::into).map_err(DocumentFormatError::Internal)?; - Ok(count as usize) + Ok(count as u64) } /// The actual handling of the deserialization process in serde diff --git a/meilisearch/src/routes/indexes/documents.rs b/meilisearch/src/routes/indexes/documents.rs index fa769a8c7..ce2df00a0 100644 --- a/meilisearch/src/routes/indexes/documents.rs +++ b/meilisearch/src/routes/indexes/documents.rs @@ -279,7 +279,7 @@ async fn document_addition( .await; let documents_count = match documents_count { - Ok(Ok(documents_count)) => documents_count as u64, + Ok(Ok(documents_count)) => documents_count, // in this case the file has not possibly be persisted. Ok(Err(e)) => return Err(e), Err(e) => {