Remove more warnings

This commit is contained in:
Loïc Lecrenier 2023-03-23 09:41:18 +01:00
parent 7169d85115
commit d18ebe4f3a
4 changed files with 19 additions and 19 deletions

View File

@ -109,7 +109,8 @@ impl<'a> Search<'a> {
self self
} }
fn is_typo_authorized(&self) -> Result<bool> { // TODO!
fn _is_typo_authorized(&self) -> Result<bool> {
let index_authorizes_typos = self.index.authorize_typos(self.rtxn)?; let index_authorizes_typos = self.index.authorize_typos(self.rtxn)?;
// only authorize typos if both the index and the query allow it. // only authorize typos if both the index and the query allow it.
Ok(self.authorize_typos && index_authorizes_typos) Ok(self.authorize_typos && index_authorizes_typos)

View File

@ -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);

View File

@ -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),

View File

@ -14,7 +14,7 @@ use crate::update::index_documents::{
create_sorter, merge_cbo_roaring_bitmaps, sorter_into_lmdb_database, valid_lmdb_key, create_sorter, merge_cbo_roaring_bitmaps, sorter_into_lmdb_database, valid_lmdb_key,
CursorClonableMmap, MergeFn, CursorClonableMmap, MergeFn,
}; };
use crate::{bucketed_position, relative_from_absolute_position, Index, Result}; use crate::{relative_from_absolute_position, Index, Result};
pub struct WordPrefixPositionDocids<'t, 'u, 'i> { pub struct WordPrefixPositionDocids<'t, 'u, 'i> {
wtxn: &'t mut heed::RwTxn<'i, 'u>, wtxn: &'t mut heed::RwTxn<'i, 'u>,