mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54:26 +01:00
Fix the clippy warnings
This commit is contained in:
parent
e0730b55b3
commit
cfd1b2cc97
@ -25,7 +25,6 @@ impl CompatV2ToV3 {
|
|||||||
CompatV2ToV3::Compat(compat) => compat.index_uuid(),
|
CompatV2ToV3::Compat(compat) => compat.index_uuid(),
|
||||||
};
|
};
|
||||||
v2_uuids
|
v2_uuids
|
||||||
.into_iter()
|
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|index| v3::meta::IndexUuid { uid: index.uid, uuid: index.uuid })
|
.map(|index| v3::meta::IndexUuid { uid: index.uid, uuid: index.uuid })
|
||||||
.collect()
|
.collect()
|
||||||
|
@ -1773,7 +1773,7 @@ async fn error_add_documents_payload_size() {
|
|||||||
"content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec metus erat, consequat in blandit venenatis, ultricies eu ipsum. Etiam luctus elit et mollis ultrices. Nam turpis risus, dictum non eros in, eleifend feugiat elit. Morbi non dolor pulvinar, sagittis mi sed, ultricies lorem. Nulla ultricies sem metus. Donec at suscipit quam, sed elementum mi. Suspendisse potenti. Fusce pharetra turpis tortor, sed eleifend odio dapibus ut. Nulla facilisi. Suspendisse elementum, dui eget aliquet dignissim, ex tellus aliquam nisl, at eleifend nisl metus tempus diam. Mauris fermentum sollicitudin efficitur. Donec dignissim est vitae elit finibus faucibus"
|
"content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec metus erat, consequat in blandit venenatis, ultricies eu ipsum. Etiam luctus elit et mollis ultrices. Nam turpis risus, dictum non eros in, eleifend feugiat elit. Morbi non dolor pulvinar, sagittis mi sed, ultricies lorem. Nulla ultricies sem metus. Donec at suscipit quam, sed elementum mi. Suspendisse potenti. Fusce pharetra turpis tortor, sed eleifend odio dapibus ut. Nulla facilisi. Suspendisse elementum, dui eget aliquet dignissim, ex tellus aliquam nisl, at eleifend nisl metus tempus diam. Mauris fermentum sollicitudin efficitur. Donec dignissim est vitae elit finibus faucibus"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
let documents: Vec<_> = (0..16000).into_iter().map(|_| document.clone()).collect();
|
let documents: Vec<_> = (0..16000).map(|_| document.clone()).collect();
|
||||||
let documents = json!(documents);
|
let documents = json!(documents);
|
||||||
let (response, code) = index.add_documents(documents, None).await;
|
let (response, code) = index.add_documents(documents, None).await;
|
||||||
|
|
||||||
@ -1934,7 +1934,6 @@ async fn batch_several_documents_addition() {
|
|||||||
let index = server.index("test");
|
let index = server.index("test");
|
||||||
|
|
||||||
let mut documents: Vec<_> = (0..150usize)
|
let mut documents: Vec<_> = (0..150usize)
|
||||||
.into_iter()
|
|
||||||
.map(|id| {
|
.map(|id| {
|
||||||
json!(
|
json!(
|
||||||
{
|
{
|
||||||
|
@ -561,7 +561,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn compute_combinations_1() {
|
fn compute_combinations_1() {
|
||||||
let b0: RoaringBitmap = (0..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
let b0: RoaringBitmap = (0..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
||||||
|
|
||||||
let parts_candidates = vec![b0];
|
let parts_candidates = vec![b0];
|
||||||
|
|
||||||
@ -575,8 +575,8 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn compute_combinations_2() {
|
fn compute_combinations_2() {
|
||||||
let b0: RoaringBitmap = (0..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
let b0: RoaringBitmap = (0..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
||||||
let b1: RoaringBitmap = (0..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
let b1: RoaringBitmap = (0..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
||||||
|
|
||||||
let parts_candidates = vec![b0, b1];
|
let parts_candidates = vec![b0, b1];
|
||||||
|
|
||||||
@ -589,10 +589,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn compute_combinations_4() {
|
fn compute_combinations_4() {
|
||||||
let b0: RoaringBitmap = (0..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
let b0: RoaringBitmap = (0..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
||||||
let b1: RoaringBitmap = (0..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
let b1: RoaringBitmap = (0..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
||||||
let b2: RoaringBitmap = (0..).into_iter().map(|x| 5 * x).take_while(|x| *x < 150).collect();
|
let b2: RoaringBitmap = (0..).map(|x| 5 * x).take_while(|x| *x < 150).collect();
|
||||||
let b3: RoaringBitmap = (0..).into_iter().map(|x| 7 * x).take_while(|x| *x < 150).collect();
|
let b3: RoaringBitmap = (0..).map(|x| 7 * x).take_while(|x| *x < 150).collect();
|
||||||
|
|
||||||
let parts_candidates = vec![b0, b1, b2, b3];
|
let parts_candidates = vec![b0, b1, b2, b3];
|
||||||
|
|
||||||
@ -610,10 +610,10 @@ mod tests {
|
|||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn compute_combinations_4_with_empty_results_at_end() {
|
fn compute_combinations_4_with_empty_results_at_end() {
|
||||||
let b0: RoaringBitmap = (1..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
let b0: RoaringBitmap = (1..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
||||||
let b1: RoaringBitmap = (1..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
let b1: RoaringBitmap = (1..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
||||||
let b2: RoaringBitmap = (1..).into_iter().map(|x| 5 * x).take_while(|x| *x < 150).collect();
|
let b2: RoaringBitmap = (1..).map(|x| 5 * x).take_while(|x| *x < 150).collect();
|
||||||
let b3: RoaringBitmap = (1..).into_iter().map(|x| 7 * x).take_while(|x| *x < 150).collect();
|
let b3: RoaringBitmap = (1..).map(|x| 7 * x).take_while(|x| *x < 150).collect();
|
||||||
|
|
||||||
let parts_candidates = vec![b0, b1, b2, b3];
|
let parts_candidates = vec![b0, b1, b2, b3];
|
||||||
|
|
||||||
@ -632,11 +632,11 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn compute_combinations_4_with_some_equal_bitmaps() {
|
fn compute_combinations_4_with_some_equal_bitmaps() {
|
||||||
let b0: RoaringBitmap = (0..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
let b0: RoaringBitmap = (0..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
|
||||||
let b1: RoaringBitmap = (0..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
let b1: RoaringBitmap = (0..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
||||||
let b2: RoaringBitmap = (0..).into_iter().map(|x| 5 * x).take_while(|x| *x < 150).collect();
|
let b2: RoaringBitmap = (0..).map(|x| 5 * x).take_while(|x| *x < 150).collect();
|
||||||
// b3 == b1
|
// b3 == b1
|
||||||
let b3: RoaringBitmap = (0..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
let b3: RoaringBitmap = (0..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
|
||||||
|
|
||||||
let parts_candidates = vec![b0, b1, b2, b3];
|
let parts_candidates = vec![b0, b1, b2, b3];
|
||||||
|
|
||||||
@ -659,7 +659,7 @@ mod tests {
|
|||||||
let parts_candidates: Vec<RoaringBitmap> = dividers
|
let parts_candidates: Vec<RoaringBitmap> = dividers
|
||||||
.iter()
|
.iter()
|
||||||
.map(|÷r| {
|
.map(|÷r| {
|
||||||
(0..).into_iter().map(|x| divider * x).take_while(|x| *x <= 210).collect()
|
(0..).map(|x| divider * x).take_while(|x| *x <= 210).collect()
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@ -689,7 +689,7 @@ mod tests {
|
|||||||
let parts_candidates: Vec<RoaringBitmap> = dividers
|
let parts_candidates: Vec<RoaringBitmap> = dividers
|
||||||
.iter()
|
.iter()
|
||||||
.map(|divider| {
|
.map(|divider| {
|
||||||
(0..).into_iter().map(|x| divider * x).take_while(|x| *x <= 100).collect()
|
(0..).map(|x| divider * x).take_while(|x| *x <= 100).collect()
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..10_000).into_iter().collect())
|
.candidates((0..10_000).collect())
|
||||||
.execute()
|
.execute()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..5_000).into_iter().collect())
|
.candidates((0..5_000).collect())
|
||||||
.execute()
|
.execute()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -521,7 +521,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..5_000).into_iter().collect())
|
.candidates((0..5_000).collect())
|
||||||
.execute()
|
.execute()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..5_000).into_iter().collect())
|
.candidates((0..5_000).collect())
|
||||||
.max_values_per_facet(1)
|
.max_values_per_facet(1)
|
||||||
.execute()
|
.execute()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -546,7 +546,7 @@ mod tests {
|
|||||||
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let facet_values = (0..1000).into_iter().map(|x| format!("{x:x}")).collect::<Vec<_>>();
|
let facet_values = (0..1000).map(|x| format!("{x:x}")).collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut documents = vec![];
|
let mut documents = vec![];
|
||||||
for i in 0..10_000 {
|
for i in 0..10_000 {
|
||||||
@ -582,7 +582,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..10_000).into_iter().collect())
|
.candidates((0..10_000).collect())
|
||||||
.execute()
|
.execute()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -590,7 +590,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..5_000).into_iter().collect())
|
.candidates((0..5_000).collect())
|
||||||
.execute()
|
.execute()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -606,7 +606,7 @@ mod tests {
|
|||||||
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let facet_values = (0..1000).into_iter().collect::<Vec<_>>();
|
let facet_values = (0..1000).collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut documents = vec![];
|
let mut documents = vec![];
|
||||||
for i in 0..1000 {
|
for i in 0..1000 {
|
||||||
@ -634,7 +634,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..1000).into_iter().collect())
|
.candidates((0..1000).collect())
|
||||||
.compute_stats()
|
.compute_stats()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -642,7 +642,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((217..777).into_iter().collect())
|
.candidates((217..777).collect())
|
||||||
.compute_stats()
|
.compute_stats()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -658,7 +658,7 @@ mod tests {
|
|||||||
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let facet_values = (0..1000).into_iter().collect::<Vec<_>>();
|
let facet_values = (0..1000).collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut documents = vec![];
|
let mut documents = vec![];
|
||||||
for i in 0..1000 {
|
for i in 0..1000 {
|
||||||
@ -686,7 +686,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..1000).into_iter().collect())
|
.candidates((0..1000).collect())
|
||||||
.compute_stats()
|
.compute_stats()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -694,7 +694,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((217..777).into_iter().collect())
|
.candidates((217..777).collect())
|
||||||
.compute_stats()
|
.compute_stats()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -710,7 +710,7 @@ mod tests {
|
|||||||
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let facet_values = (0..1000).into_iter().collect::<Vec<_>>();
|
let facet_values = (0..1000).collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut documents = vec![];
|
let mut documents = vec![];
|
||||||
for i in 0..1000 {
|
for i in 0..1000 {
|
||||||
@ -738,7 +738,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..1000).into_iter().collect())
|
.candidates((0..1000).collect())
|
||||||
.compute_stats()
|
.compute_stats()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -746,7 +746,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((217..777).into_iter().collect())
|
.candidates((217..777).collect())
|
||||||
.compute_stats()
|
.compute_stats()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -762,7 +762,7 @@ mod tests {
|
|||||||
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let facet_values = (0..1000).into_iter().collect::<Vec<_>>();
|
let facet_values = (0..1000).collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut documents = vec![];
|
let mut documents = vec![];
|
||||||
for i in 0..1000 {
|
for i in 0..1000 {
|
||||||
@ -794,7 +794,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((0..1000).into_iter().collect())
|
.candidates((0..1000).collect())
|
||||||
.compute_stats()
|
.compute_stats()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -802,7 +802,7 @@ mod tests {
|
|||||||
|
|
||||||
let map = FacetDistribution::new(&txn, &index)
|
let map = FacetDistribution::new(&txn, &index)
|
||||||
.facets(std::iter::once("colour"))
|
.facets(std::iter::once("colour"))
|
||||||
.candidates((217..777).into_iter().collect())
|
.candidates((217..777).collect())
|
||||||
.compute_stats()
|
.compute_stats()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ mod tests {
|
|||||||
let indexes = [get_simple_index(), get_random_looking_index()];
|
let indexes = [get_simple_index(), get_random_looking_index()];
|
||||||
for (i, index) in indexes.iter().enumerate() {
|
for (i, index) in indexes.iter().enumerate() {
|
||||||
let txn = index.env.read_txn().unwrap();
|
let txn = index.env.read_txn().unwrap();
|
||||||
let candidates = (0..=255).into_iter().collect::<RoaringBitmap>();
|
let candidates = (0..=255).collect::<RoaringBitmap>();
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
iterate_over_facet_distribution(
|
iterate_over_facet_distribution(
|
||||||
&txn,
|
&txn,
|
||||||
@ -166,7 +166,7 @@ mod tests {
|
|||||||
let indexes = [get_simple_index(), get_random_looking_index()];
|
let indexes = [get_simple_index(), get_random_looking_index()];
|
||||||
for (i, index) in indexes.iter().enumerate() {
|
for (i, index) in indexes.iter().enumerate() {
|
||||||
let txn = index.env.read_txn().unwrap();
|
let txn = index.env.read_txn().unwrap();
|
||||||
let candidates = (0..=255).into_iter().collect::<RoaringBitmap>();
|
let candidates = (0..=255).collect::<RoaringBitmap>();
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
let mut nbr_facets = 0;
|
let mut nbr_facets = 0;
|
||||||
iterate_over_facet_distribution(
|
iterate_over_facet_distribution(
|
||||||
|
@ -410,7 +410,7 @@ mod tests {
|
|||||||
|
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
|
|
||||||
for i in (0..=255).into_iter().rev() {
|
for i in (0..=255).rev() {
|
||||||
let i = i as f64;
|
let i = i as f64;
|
||||||
let start = Bound::Included(i);
|
let start = Bound::Included(i);
|
||||||
let end = Bound::Included(255.);
|
let end = Bound::Included(255.);
|
||||||
@ -431,7 +431,7 @@ mod tests {
|
|||||||
|
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
|
|
||||||
for i in (0..=255).into_iter().rev() {
|
for i in (0..=255).rev() {
|
||||||
let i = i as f64;
|
let i = i as f64;
|
||||||
let start = Bound::Excluded(i);
|
let start = Bound::Excluded(i);
|
||||||
let end = Bound::Excluded(255.);
|
let end = Bound::Excluded(255.);
|
||||||
@ -466,7 +466,7 @@ mod tests {
|
|||||||
|
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
|
|
||||||
for i in (0..=128).into_iter().rev() {
|
for i in (0..=128).rev() {
|
||||||
let i = i as f64;
|
let i = i as f64;
|
||||||
let start = Bound::Included(i);
|
let start = Bound::Included(i);
|
||||||
let end = Bound::Included(255. - i);
|
let end = Bound::Included(255. - i);
|
||||||
@ -491,7 +491,7 @@ mod tests {
|
|||||||
|
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
|
|
||||||
for i in (0..=128).into_iter().rev() {
|
for i in (0..=128).rev() {
|
||||||
let i = i as f64;
|
let i = i as f64;
|
||||||
let start = Bound::Excluded(i);
|
let start = Bound::Excluded(i);
|
||||||
let end = Bound::Excluded(255. - i);
|
let end = Bound::Excluded(255. - i);
|
||||||
|
@ -132,7 +132,7 @@ mod tests {
|
|||||||
let indexes = [get_simple_index(), get_random_looking_index()];
|
let indexes = [get_simple_index(), get_random_looking_index()];
|
||||||
for (i, index) in indexes.iter().enumerate() {
|
for (i, index) in indexes.iter().enumerate() {
|
||||||
let txn = index.env.read_txn().unwrap();
|
let txn = index.env.read_txn().unwrap();
|
||||||
let candidates = (200..=300).into_iter().collect::<RoaringBitmap>();
|
let candidates = (200..=300).collect::<RoaringBitmap>();
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
let iter = ascending_facet_sort(&txn, index.content, 0, candidates).unwrap();
|
let iter = ascending_facet_sort(&txn, index.content, 0, candidates).unwrap();
|
||||||
for el in iter {
|
for el in iter {
|
||||||
@ -154,7 +154,7 @@ mod tests {
|
|||||||
];
|
];
|
||||||
for (i, index) in indexes.iter().enumerate() {
|
for (i, index) in indexes.iter().enumerate() {
|
||||||
let txn = index.env.read_txn().unwrap();
|
let txn = index.env.read_txn().unwrap();
|
||||||
let candidates = (200..=300).into_iter().collect::<RoaringBitmap>();
|
let candidates = (200..=300).collect::<RoaringBitmap>();
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
let iter = ascending_facet_sort(&txn, index.content, 0, candidates.clone()).unwrap();
|
let iter = ascending_facet_sort(&txn, index.content, 0, candidates.clone()).unwrap();
|
||||||
for el in iter {
|
for el in iter {
|
||||||
|
@ -142,7 +142,7 @@ mod tests {
|
|||||||
];
|
];
|
||||||
for (i, index) in indexes.iter().enumerate() {
|
for (i, index) in indexes.iter().enumerate() {
|
||||||
let txn = index.env.read_txn().unwrap();
|
let txn = index.env.read_txn().unwrap();
|
||||||
let candidates = (200..=300).into_iter().collect::<RoaringBitmap>();
|
let candidates = (200..=300).collect::<RoaringBitmap>();
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
let db = index.content.remap_key_type::<FacetGroupKeyCodec<ByteSliceRefCodec>>();
|
let db = index.content.remap_key_type::<FacetGroupKeyCodec<ByteSliceRefCodec>>();
|
||||||
let iter = descending_facet_sort(&txn, db, 0, candidates).unwrap();
|
let iter = descending_facet_sort(&txn, db, 0, candidates).unwrap();
|
||||||
@ -165,7 +165,7 @@ mod tests {
|
|||||||
];
|
];
|
||||||
for (i, index) in indexes.iter().enumerate() {
|
for (i, index) in indexes.iter().enumerate() {
|
||||||
let txn = index.env.read_txn().unwrap();
|
let txn = index.env.read_txn().unwrap();
|
||||||
let candidates = (200..=300).into_iter().collect::<RoaringBitmap>();
|
let candidates = (200..=300).collect::<RoaringBitmap>();
|
||||||
let mut results = String::new();
|
let mut results = String::new();
|
||||||
let db = index.content.remap_key_type::<FacetGroupKeyCodec<ByteSliceRefCodec>>();
|
let db = index.content.remap_key_type::<FacetGroupKeyCodec<ByteSliceRefCodec>>();
|
||||||
let iter = descending_facet_sort(&txn, db, 0, candidates.clone()).unwrap();
|
let iter = descending_facet_sort(&txn, db, 0, candidates.clone()).unwrap();
|
||||||
|
@ -629,7 +629,7 @@ fn create_matching_words(
|
|||||||
// create a CONSECUTIVE matchings words wrapping all word in the phrase
|
// create a CONSECUTIVE matchings words wrapping all word in the phrase
|
||||||
PrimitiveQueryPart::Phrase(words) => {
|
PrimitiveQueryPart::Phrase(words) => {
|
||||||
let ids: Vec<_> =
|
let ids: Vec<_> =
|
||||||
(0..words.len()).into_iter().map(|i| id + i as PrimitiveWordId).collect();
|
(0..words.len()).map(|i| id + i as PrimitiveWordId).collect();
|
||||||
// Require that all words of the phrase have a corresponding MatchingWord
|
// Require that all words of the phrase have a corresponding MatchingWord
|
||||||
// before adding any of them to the matching_words result
|
// before adding any of them to the matching_words result
|
||||||
if let Some(phrase_matching_words) = words
|
if let Some(phrase_matching_words) = words
|
||||||
@ -687,7 +687,6 @@ fn create_matching_words(
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let ids: Vec<_> = (0..words.len())
|
let ids: Vec<_> = (0..words.len())
|
||||||
.into_iter()
|
|
||||||
.map(|i| id + i as PrimitiveWordId)
|
.map(|i| id + i as PrimitiveWordId)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
@ -699,21 +699,21 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn many_field_ids_prepend() {
|
fn many_field_ids_prepend() {
|
||||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
||||||
for i in (0..256).into_iter().rev() {
|
for i in (0..256).rev() {
|
||||||
let mut bitmap = RoaringBitmap::new();
|
let mut bitmap = RoaringBitmap::new();
|
||||||
bitmap.insert(i as u32);
|
bitmap.insert(i as u32);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
index.insert(&mut txn, 0, &(i as f64), &bitmap);
|
index.insert(&mut txn, 0, &(i as f64), &bitmap);
|
||||||
txn.commit().unwrap();
|
txn.commit().unwrap();
|
||||||
}
|
}
|
||||||
for i in (0..256).into_iter().rev() {
|
for i in (0..256).rev() {
|
||||||
let mut bitmap = RoaringBitmap::new();
|
let mut bitmap = RoaringBitmap::new();
|
||||||
bitmap.insert(i as u32);
|
bitmap.insert(i as u32);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
index.insert(&mut txn, 2, &(i as f64), &bitmap);
|
index.insert(&mut txn, 2, &(i as f64), &bitmap);
|
||||||
txn.commit().unwrap();
|
txn.commit().unwrap();
|
||||||
}
|
}
|
||||||
for i in (0..256).into_iter().rev() {
|
for i in (0..256).rev() {
|
||||||
let mut bitmap = RoaringBitmap::new();
|
let mut bitmap = RoaringBitmap::new();
|
||||||
bitmap.insert(i as u32);
|
bitmap.insert(i as u32);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
@ -733,7 +733,7 @@ mod tests {
|
|||||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
|
|
||||||
for i in (0..256).into_iter().rev() {
|
for i in (0..256).rev() {
|
||||||
let mut bitmap = RoaringBitmap::new();
|
let mut bitmap = RoaringBitmap::new();
|
||||||
bitmap.insert(i);
|
bitmap.insert(i);
|
||||||
index.insert(&mut txn, 0, &(i as f64), &bitmap);
|
index.insert(&mut txn, 0, &(i as f64), &bitmap);
|
||||||
@ -749,7 +749,7 @@ mod tests {
|
|||||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
|
|
||||||
let mut keys = (0..256).into_iter().collect::<Vec<_>>();
|
let mut keys = (0..256).collect::<Vec<_>>();
|
||||||
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
||||||
keys.shuffle(&mut rng);
|
keys.shuffle(&mut rng);
|
||||||
|
|
||||||
@ -768,7 +768,7 @@ mod tests {
|
|||||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
|
|
||||||
let mut keys = (0..256).into_iter().collect::<Vec<_>>();
|
let mut keys = (0..256).collect::<Vec<_>>();
|
||||||
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
||||||
keys.shuffle(&mut rng);
|
keys.shuffle(&mut rng);
|
||||||
|
|
||||||
@ -796,7 +796,7 @@ mod tests {
|
|||||||
index.insert(&mut txn, 0, &(i as f64), &bitmap);
|
index.insert(&mut txn, 0, &(i as f64), &bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in (200..256).into_iter().rev() {
|
for i in (200..256).rev() {
|
||||||
index.verify_structure_validity(&txn, 0);
|
index.verify_structure_validity(&txn, 0);
|
||||||
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
||||||
}
|
}
|
||||||
@ -805,7 +805,7 @@ mod tests {
|
|||||||
milli_snap!(format!("{index}"), 200);
|
milli_snap!(format!("{index}"), 200);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
|
|
||||||
for i in (150..200).into_iter().rev() {
|
for i in (150..200).rev() {
|
||||||
index.verify_structure_validity(&txn, 0);
|
index.verify_structure_validity(&txn, 0);
|
||||||
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
||||||
}
|
}
|
||||||
@ -813,7 +813,7 @@ mod tests {
|
|||||||
txn.commit().unwrap();
|
txn.commit().unwrap();
|
||||||
milli_snap!(format!("{index}"), 150);
|
milli_snap!(format!("{index}"), 150);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
for i in (100..150).into_iter().rev() {
|
for i in (100..150).rev() {
|
||||||
index.verify_structure_validity(&txn, 0);
|
index.verify_structure_validity(&txn, 0);
|
||||||
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
||||||
}
|
}
|
||||||
@ -821,7 +821,7 @@ mod tests {
|
|||||||
txn.commit().unwrap();
|
txn.commit().unwrap();
|
||||||
milli_snap!(format!("{index}"), 100);
|
milli_snap!(format!("{index}"), 100);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
for i in (17..100).into_iter().rev() {
|
for i in (17..100).rev() {
|
||||||
index.verify_structure_validity(&txn, 0);
|
index.verify_structure_validity(&txn, 0);
|
||||||
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
||||||
}
|
}
|
||||||
@ -829,14 +829,14 @@ mod tests {
|
|||||||
txn.commit().unwrap();
|
txn.commit().unwrap();
|
||||||
milli_snap!(format!("{index}"), 17);
|
milli_snap!(format!("{index}"), 17);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
for i in (15..17).into_iter().rev() {
|
for i in (15..17).rev() {
|
||||||
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
||||||
}
|
}
|
||||||
index.verify_structure_validity(&txn, 0);
|
index.verify_structure_validity(&txn, 0);
|
||||||
txn.commit().unwrap();
|
txn.commit().unwrap();
|
||||||
milli_snap!(format!("{index}"), 15);
|
milli_snap!(format!("{index}"), 15);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
for i in (0..15).into_iter().rev() {
|
for i in (0..15).rev() {
|
||||||
index.verify_structure_validity(&txn, 0);
|
index.verify_structure_validity(&txn, 0);
|
||||||
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
|
||||||
}
|
}
|
||||||
@ -893,7 +893,7 @@ mod tests {
|
|||||||
index.insert(&mut txn, 0, &(i as f64), &bitmap);
|
index.insert(&mut txn, 0, &(i as f64), &bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut keys = (0..256).into_iter().collect::<Vec<_>>();
|
let mut keys = (0..256).collect::<Vec<_>>();
|
||||||
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
||||||
keys.shuffle(&mut rng);
|
keys.shuffle(&mut rng);
|
||||||
|
|
||||||
@ -930,7 +930,7 @@ mod tests {
|
|||||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
|
|
||||||
let mut keys = (0..16).into_iter().collect::<Vec<_>>();
|
let mut keys = (0..16).collect::<Vec<_>>();
|
||||||
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
||||||
keys.shuffle(&mut rng);
|
keys.shuffle(&mut rng);
|
||||||
for i in 0..4 {
|
for i in 0..4 {
|
||||||
@ -951,7 +951,7 @@ mod tests {
|
|||||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
|
|
||||||
let mut keys = (0..64).into_iter().collect::<Vec<_>>();
|
let mut keys = (0..64).collect::<Vec<_>>();
|
||||||
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
||||||
keys.shuffle(&mut rng);
|
keys.shuffle(&mut rng);
|
||||||
|
|
||||||
@ -983,7 +983,7 @@ mod tests {
|
|||||||
let index = FacetIndex::<StrRefCodec>::new(4, 8, 5);
|
let index = FacetIndex::<StrRefCodec>::new(4, 8, 5);
|
||||||
let mut txn = index.env.write_txn().unwrap();
|
let mut txn = index.env.write_txn().unwrap();
|
||||||
|
|
||||||
let mut keys = (1000..1064).into_iter().collect::<Vec<_>>();
|
let mut keys = (1000..1064).collect::<Vec<_>>();
|
||||||
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
|
||||||
keys.shuffle(&mut rng);
|
keys.shuffle(&mut rng);
|
||||||
|
|
||||||
|
@ -1613,7 +1613,6 @@ mod tests {
|
|||||||
// Create 200 documents with a long text
|
// Create 200 documents with a long text
|
||||||
let content = {
|
let content = {
|
||||||
let documents_iter = (0..200i32)
|
let documents_iter = (0..200i32)
|
||||||
.into_iter()
|
|
||||||
.map(|i| serde_json::json!({ "id": i, "script": script }))
|
.map(|i| serde_json::json!({ "id": i, "script": script }))
|
||||||
.filter_map(|json| match json {
|
.filter_map(|json| match json {
|
||||||
serde_json::Value::Object(object) => Some(object),
|
serde_json::Value::Object(object) => Some(object),
|
||||||
|
Loading…
Reference in New Issue
Block a user