mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-27 15:10:05 +01:00
chore: Avoid using the external library Itertools
This commit is contained in:
parent
2719f1ad3b
commit
5829d08bc0
@ -8,7 +8,6 @@ authors = ["Kerollmops <renault.cle@gmail.com>"]
|
||||
bincode = "1.0"
|
||||
byteorder = "1.2"
|
||||
fnv = "1.0"
|
||||
itertools = "0.7"
|
||||
lazy_static = "1.1"
|
||||
linked-hash-map = { version = "0.5", features = ["serde_impl"] }
|
||||
sdset = "0.3"
|
||||
|
@ -2,7 +2,6 @@ use std::error::Error;
|
||||
|
||||
use fst::{IntoStreamer, Streamer};
|
||||
use group_by::GroupBy;
|
||||
use itertools::{Itertools, Either};
|
||||
use sdset::duo::DifferenceByKey;
|
||||
use sdset::{Set, SetOperation};
|
||||
|
||||
@ -47,7 +46,9 @@ impl OpBuilder {
|
||||
|
||||
pub fn merge(self) -> Result<PositiveBlob, Box<Error>> {
|
||||
let groups = GroupBy::new(&self.blobs, blob_same_sign);
|
||||
let (positives, negatives): (Vec<_>, Vec<_>) = groups.partition_map(|blobs| {
|
||||
let mut positives = Vec::new();
|
||||
let mut negatives = Vec::new();
|
||||
for blobs in groups {
|
||||
match blobs[0].sign() {
|
||||
Sign::Positive => {
|
||||
let mut op_builder = positive::OpBuilder::with_capacity(blobs.len());
|
||||
@ -65,7 +66,7 @@ impl OpBuilder {
|
||||
}
|
||||
let (map, doc_indexes) = builder.into_inner().unwrap();
|
||||
let blob = PositiveBlob::from_bytes(map, doc_indexes).unwrap();
|
||||
Either::Left(blob)
|
||||
positives.push(blob);
|
||||
},
|
||||
Sign::Negative => {
|
||||
let mut op_builder = negative::OpBuilder::with_capacity(blobs.len());
|
||||
@ -73,10 +74,10 @@ impl OpBuilder {
|
||||
op_builder.push(unwrap_negative(blob));
|
||||
}
|
||||
let blob = op_builder.union().into_negative_blob();
|
||||
Either::Right(blob)
|
||||
negatives.push(blob);
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let mut zipped = positives.into_iter().zip(negatives);
|
||||
let mut buffer = Vec::new();
|
||||
|
Loading…
x
Reference in New Issue
Block a user