Small code reorganisation

This commit is contained in:
Loïc Lecrenier 2023-03-08 10:12:05 +01:00
parent 57fa689131
commit 4e266211bf
3 changed files with 8 additions and 41 deletions

View File

@ -70,6 +70,8 @@ pub mod update;
#[macro_use]
pub mod snapshot_tests;
pub use search::new::{execute_search, SearchContext};
use std::collections::{BTreeMap, HashMap};
use std::convert::{TryFrom, TryInto};
use std::hash::BuildHasherDefault;

View File

@ -11,6 +11,8 @@ mod small_bitmap;
mod sort;
mod words;
pub use logger::{DefaultSearchLogger, SearchLogger};
use std::collections::BTreeSet;
use charabia::Tokenize;
@ -24,7 +26,6 @@ pub use ranking_rules::{
use roaring::RoaringBitmap;
use self::interner::Interner;
use self::logger::SearchLogger;
use self::query_term::Phrase;
use self::resolve_query_graph::{resolve_query_graph, NodeDocIdsCache};
use crate::search::new::query_term::located_query_terms_from_string;
@ -57,7 +58,7 @@ impl<'search> SearchContext<'search> {
}
#[allow(clippy::too_many_arguments)]
pub fn resolve_maximally_reduced_query_graph<'search>(
fn resolve_maximally_reduced_query_graph<'search>(
ctx: &mut SearchContext<'search>,
universe: &RoaringBitmap,
query_graph: &QueryGraph,

View File

@ -1,31 +1,3 @@
// #[macro_export]
// macro_rules! iter_bitmap {
// ($bitmap:expr, $id:lifetime, $p:pat, $body:block) => {
// match $bitmap {
// SmallBitmap::Tiny(mut set) => {
// while set > 0 {
// let $p = set.trailing_zeros() as u16;
// $body;
// set &= set - 1;
// }
// }
// SmallBitmap::Small(sets) => {
// let mut base = 0;
// for set in sets.iter() {
// let mut set = *set;
// while set > 0 {
// let idx = set.trailing_zeros() as u16;
// let $p = idx + base;
// set &= set - 1;
// $body;
// }
// base += 64;
// }
// }
// }
// };
// }
#[derive(Clone)]
pub enum SmallBitmap {
Tiny(u64),
@ -256,16 +228,8 @@ mod tests {
bitmap2.insert(x * 3);
}
bitmap1.intersection(&bitmap2);
// println!("{}", bitmap.contains(12));
// bitmap1
// .iter(|x| {
// println!("{x}");
// Ok(())
// })
// .unwrap();
// iter_bitmap!(bitmap1, 'loop1, x, {
// println!("{x}");
// })
for v in bitmap1.iter() {
println!("{v}");
}
}
}