mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
Use bumparaw-collections in Meilisearch/milli
This commit is contained in:
parent
1995040846
commit
89637bcaaf
15 changed files with 78 additions and 70 deletions
|
@ -1,7 +1,7 @@
|
|||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use bumparaw_collections::RawMap;
|
||||
use heed::RoTxn;
|
||||
use raw_collections::RawMap;
|
||||
use serde_json::value::RawValue;
|
||||
|
||||
use super::vector_document::VectorDocument;
|
||||
|
|
|
@ -69,12 +69,12 @@ use std::io::BufReader;
|
|||
use std::{io, iter, mem};
|
||||
|
||||
use bumpalo::Bump;
|
||||
use bumparaw_collections::bbbul::{BitPacker, BitPacker4x};
|
||||
use bumparaw_collections::map::FrozenMap;
|
||||
use bumparaw_collections::{Bbbul, FrozenBbbul};
|
||||
use grenad::ReaderCursor;
|
||||
use hashbrown::hash_map::RawEntryMut;
|
||||
use hashbrown::HashMap;
|
||||
use raw_collections::bbbul::{BitPacker, BitPacker4x};
|
||||
use raw_collections::map::FrozenMap;
|
||||
use raw_collections::{Bbbul, FrozenBbbul};
|
||||
use roaring::RoaringBitmap;
|
||||
use rustc_hash::FxBuildHasher;
|
||||
|
||||
|
|
|
@ -176,9 +176,9 @@ pub fn tokenizer_builder<'a>(
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use bumpalo::Bump;
|
||||
use bumparaw_collections::RawMap;
|
||||
use charabia::TokenizerBuilder;
|
||||
use meili_snap::snapshot;
|
||||
use raw_collections::RawMap;
|
||||
use serde_json::json;
|
||||
use serde_json::value::RawValue;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::ops::ControlFlow;
|
||||
|
||||
use bumpalo::Bump;
|
||||
use bumparaw_collections::RawVec;
|
||||
use serde::de::{DeserializeSeed, Deserializer as _, Visitor};
|
||||
use serde_json::value::RawValue;
|
||||
|
||||
|
@ -360,7 +361,7 @@ impl<'a> DeserrRawValue<'a> {
|
|||
}
|
||||
|
||||
pub struct DeserrRawVec<'a> {
|
||||
vec: raw_collections::RawVec<'a>,
|
||||
vec: RawVec<'a>,
|
||||
alloc: &'a Bump,
|
||||
}
|
||||
|
||||
|
@ -379,7 +380,7 @@ impl<'a> deserr::Sequence for DeserrRawVec<'a> {
|
|||
}
|
||||
|
||||
pub struct DeserrRawVecIter<'a> {
|
||||
it: raw_collections::vec::iter::IntoIter<'a>,
|
||||
it: bumparaw_collections::vec::iter::IntoIter<'a>,
|
||||
alloc: &'a Bump,
|
||||
}
|
||||
|
||||
|
@ -393,7 +394,7 @@ impl<'a> Iterator for DeserrRawVecIter<'a> {
|
|||
}
|
||||
|
||||
pub struct DeserrRawMap<'a> {
|
||||
map: raw_collections::RawMap<'a>,
|
||||
map: bumparaw_collections::RawMap<'a>,
|
||||
alloc: &'a Bump,
|
||||
}
|
||||
|
||||
|
@ -416,7 +417,7 @@ impl<'a> deserr::Map for DeserrRawMap<'a> {
|
|||
}
|
||||
|
||||
pub struct DeserrRawMapIter<'a> {
|
||||
it: raw_collections::map::iter::IntoIter<'a>,
|
||||
it: bumparaw_collections::map::iter::IntoIter<'a>,
|
||||
alloc: &'a Bump,
|
||||
}
|
||||
|
||||
|
@ -615,7 +616,7 @@ impl<'de> Visitor<'de> for DeserrRawValueVisitor<'de> {
|
|||
where
|
||||
A: serde::de::SeqAccess<'de>,
|
||||
{
|
||||
let mut raw_vec = raw_collections::RawVec::new_in(self.alloc);
|
||||
let mut raw_vec = RawVec::new_in(self.alloc);
|
||||
while let Some(next) = seq.next_element()? {
|
||||
raw_vec.push(next);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use bumpalo::collections::CollectIn;
|
||||
use bumpalo::Bump;
|
||||
use bumparaw_collections::RawMap;
|
||||
use hashbrown::hash_map::Entry;
|
||||
use heed::RoTxn;
|
||||
use memmap2::Mmap;
|
||||
use raw_collections::RawMap;
|
||||
use rayon::slice::ParallelSlice;
|
||||
use serde_json::value::RawValue;
|
||||
use serde_json::Deserializer;
|
||||
|
@ -545,8 +545,8 @@ impl MergeChanges for MergeDocumentForReplacement {
|
|||
match operations.last() {
|
||||
Some(InnerDocOp::Addition(DocumentOffset { content })) => {
|
||||
let document = serde_json::from_slice(content).unwrap();
|
||||
let document = raw_collections::RawMap::from_raw_value(document, doc_alloc)
|
||||
.map_err(UserError::SerdeJson)?;
|
||||
let document =
|
||||
RawMap::from_raw_value(document, doc_alloc).map_err(UserError::SerdeJson)?;
|
||||
|
||||
if is_new {
|
||||
Ok(Some(DocumentChange::Insertion(Insertion::create(
|
||||
|
@ -632,8 +632,8 @@ impl MergeChanges for MergeDocumentForUpdates {
|
|||
}
|
||||
};
|
||||
let document = serde_json::from_slice(content).unwrap();
|
||||
let document = raw_collections::RawMap::from_raw_value(document, doc_alloc)
|
||||
.map_err(UserError::SerdeJson)?;
|
||||
let document =
|
||||
RawMap::from_raw_value(document, doc_alloc).map_err(UserError::SerdeJson)?;
|
||||
|
||||
Some(Versions::single(document))
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ impl MergeChanges for MergeDocumentForUpdates {
|
|||
};
|
||||
|
||||
let document = serde_json::from_slice(content).unwrap();
|
||||
let document = raw_collections::RawMap::from_raw_value(document, doc_alloc)
|
||||
let document = RawMap::from_raw_value(document, doc_alloc)
|
||||
.map_err(UserError::SerdeJson)?;
|
||||
Ok(document)
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@ use std::sync::{OnceLock, RwLock};
|
|||
use std::thread::{self, Builder};
|
||||
|
||||
use big_s::S;
|
||||
use bumparaw_collections::RawMap;
|
||||
use document_changes::{extract, DocumentChanges, IndexingContext, Progress};
|
||||
pub use document_deletion::DocumentDeletion;
|
||||
pub use document_operation::{DocumentOperation, PayloadStats};
|
||||
|
@ -13,7 +14,6 @@ use heed::{RoTxn, RwTxn};
|
|||
use itertools::{merge_join_by, EitherOrBoth};
|
||||
pub use partial_dump::PartialDump;
|
||||
use rand::SeedableRng as _;
|
||||
use raw_collections::RawMap;
|
||||
use time::OffsetDateTime;
|
||||
pub use update_by_function::UpdateByFunction;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::ops::DerefMut;
|
||||
|
||||
use bumparaw_collections::RawMap;
|
||||
use rayon::iter::IndexedParallelIterator;
|
||||
use serde_json::value::RawValue;
|
||||
|
||||
|
@ -75,8 +76,8 @@ where
|
|||
self.primary_key.extract_fields_and_docid(document, fields_ids_map, doc_alloc)?;
|
||||
let external_document_id = external_document_id.to_de();
|
||||
|
||||
let document = raw_collections::RawMap::from_raw_value(document, doc_alloc)
|
||||
.map_err(InternalError::SerdeJson)?;
|
||||
let document =
|
||||
RawMap::from_raw_value(document, doc_alloc).map_err(InternalError::SerdeJson)?;
|
||||
|
||||
let insertion = Insertion::create(docid, external_document_id, Versions::single(document));
|
||||
Ok(Some(DocumentChange::Insertion(insertion)))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use raw_collections::RawMap;
|
||||
use bumparaw_collections::RawMap;
|
||||
use rayon::iter::IndexedParallelIterator;
|
||||
use rayon::slice::ParallelSlice as _;
|
||||
use rhai::{Dynamic, Engine, OptimizationLevel, Scope, AST};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use std::collections::BTreeSet;
|
||||
|
||||
use bumpalo::Bump;
|
||||
use bumparaw_collections::RawMap;
|
||||
use deserr::{Deserr, IntoValue};
|
||||
use heed::RoTxn;
|
||||
use raw_collections::RawMap;
|
||||
use serde::Serialize;
|
||||
use serde_json::value::RawValue;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue