mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Move the Object type in the lib.rs file and use it everywhere
This commit is contained in:
parent
0146175fe6
commit
fcfc4caf8c
11 changed files with 43 additions and 51 deletions
|
@ -1,9 +1,10 @@
|
|||
use std::io::{self, Write};
|
||||
|
||||
use grenad::{CompressionType, WriterBuilder};
|
||||
use serde_json::{to_writer, Map, Value};
|
||||
use serde_json::{to_writer, Value};
|
||||
|
||||
use super::{DocumentsBatchIndex, Error, DOCUMENTS_BATCH_INDEX_KEY};
|
||||
use crate::Object;
|
||||
|
||||
/// The `DocumentsBatchBuilder` provides a way to build a documents batch in the intermediary
|
||||
/// format used by milli.
|
||||
|
@ -55,7 +56,7 @@ impl<W: Write> DocumentsBatchBuilder<W> {
|
|||
}
|
||||
|
||||
/// Appends a new JSON object into the batch and updates the `DocumentsBatchIndex` accordingly.
|
||||
pub fn append_json_object(&mut self, object: &Map<String, Value>) -> io::Result<()> {
|
||||
pub fn append_json_object(&mut self, object: &Object) -> io::Result<()> {
|
||||
// Make sure that we insert the fields ids in order as the obkv writer has this requirement.
|
||||
let mut fields_ids: Vec<_> = object.keys().map(|k| self.fields_index.insert(&k)).collect();
|
||||
fields_ids.sort_unstable();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue