From 4e266211bfdc60dcc0117c6411c31546aad508fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Wed, 8 Mar 2023 10:12:05 +0100 Subject: [PATCH] Small code reorganisation --- milli/src/lib.rs | 2 ++ milli/src/search/new/mod.rs | 5 ++-- milli/src/search/new/small_bitmap.rs | 42 ++-------------------------- 3 files changed, 8 insertions(+), 41 deletions(-) diff --git a/milli/src/lib.rs b/milli/src/lib.rs index af4324ae4..ade6ee8bd 100644 --- a/milli/src/lib.rs +++ b/milli/src/lib.rs @@ -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; diff --git a/milli/src/search/new/mod.rs b/milli/src/search/new/mod.rs index 0dbdd93b0..235075580 100644 --- a/milli/src/search/new/mod.rs +++ b/milli/src/search/new/mod.rs @@ -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, diff --git a/milli/src/search/new/small_bitmap.rs b/milli/src/search/new/small_bitmap.rs index f7adecee0..fea5a5684 100644 --- a/milli/src/search/new/small_bitmap.rs +++ b/milli/src/search/new/small_bitmap.rs @@ -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}"); + } } }