mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
revert: Revert pass by reference API change
This commit is contained in:
parent
7c0e544839
commit
935a724c57
@ -450,7 +450,7 @@ impl Search {
|
||||
let documents = index.documents(&txn, result.documents_ids)?;
|
||||
let mut jsons = Vec::new();
|
||||
for (_, obkv) in documents {
|
||||
let json = milli::obkv_to_json(&displayed_fields, &fields_ids_map, &obkv)?;
|
||||
let json = milli::obkv_to_json(&displayed_fields, &fields_ids_map, obkv)?;
|
||||
jsons.push(json);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ pub fn absolute_from_relative_position(field_id: FieldId, relative: RelativePosi
|
||||
pub fn obkv_to_json(
|
||||
displayed_fields: &[FieldId],
|
||||
fields_ids_map: &FieldsIdsMap,
|
||||
obkv: &obkv::KvReaderU16,
|
||||
obkv: obkv::KvReaderU16,
|
||||
) -> Result<Object> {
|
||||
displayed_fields
|
||||
.iter()
|
||||
@ -106,7 +106,7 @@ pub fn obkv_to_json(
|
||||
}
|
||||
|
||||
/// Transform every field of a raw obkv store into a JSON Object.
|
||||
pub fn all_obkv_to_json(obkv: &obkv::KvReaderU16, fields_ids_map: &FieldsIdsMap) -> Result<Object> {
|
||||
pub fn all_obkv_to_json(obkv: obkv::KvReaderU16, fields_ids_map: &FieldsIdsMap) -> Result<Object> {
|
||||
let all_keys = obkv.iter().map(|(k, _v)| k).collect::<Vec<_>>();
|
||||
obkv_to_json(all_keys.as_slice(), fields_ids_map, obkv)
|
||||
}
|
||||
@ -309,7 +309,7 @@ mod tests {
|
||||
"field2": 4321,
|
||||
});
|
||||
let expected = expected.as_object().unwrap();
|
||||
let actual = all_obkv_to_json(&obkv, &fields_ids_map).unwrap();
|
||||
let actual = all_obkv_to_json(obkv, &fields_ids_map).unwrap();
|
||||
|
||||
assert_eq!(&actual, expected);
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ mod tests {
|
||||
let fidmap = index.fields_ids_map(&rtxn).unwrap();
|
||||
for document in index.all_documents(&rtxn).unwrap() {
|
||||
let document = document.unwrap();
|
||||
let json = crate::obkv_to_json(&fidmap.ids().collect::<Vec<_>>(), &fidmap, &document.1)
|
||||
let json = crate::obkv_to_json(&fidmap.ids().collect::<Vec<_>>(), &fidmap, document.1)
|
||||
.unwrap();
|
||||
println!("json: {:?}", json);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user