From c63c7377e6ed793e68fc11ae81b9815d600ce543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Mon, 20 Mar 2023 09:37:11 +0100 Subject: [PATCH] Switch order of MappedInterner generic params --- milli/src/search/new/graph_based_ranking_rule.rs | 2 +- milli/src/search/new/interner.rs | 8 ++++---- milli/src/search/new/logger/detailed.rs | 10 +++++----- milli/src/search/new/logger/mod.rs | 8 ++++---- .../search/new/ranking_rule_graph/cheapest_paths.rs | 6 +++--- milli/src/search/new/ranking_rule_graph/mod.rs | 4 ++-- .../src/search/new/ranking_rule_graph/proximity/mod.rs | 2 +- milli/src/search/new/ranking_rule_graph/typo/mod.rs | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/milli/src/search/new/graph_based_ranking_rule.rs b/milli/src/search/new/graph_based_ranking_rule.rs index 4a96855ce..efc5a6dcc 100644 --- a/milli/src/search/new/graph_based_ranking_rule.rs +++ b/milli/src/search/new/graph_based_ranking_rule.rs @@ -89,7 +89,7 @@ pub struct GraphBasedRankingRuleState { /// Cache used to optimistically discard paths that resolve to no documents. dead_ends_cache: DeadEndsCache, /// A structure giving the list of possible costs from each node to the end node - all_distances: MappedInterner, QueryNode>, + all_distances: MappedInterner>, /// An index in the first element of `all_distances`, giving the cost of the next bucket cur_distance_idx: usize, } diff --git a/milli/src/search/new/interner.rs b/milli/src/search/new/interner.rs index ea8b987fd..c26e18524 100644 --- a/milli/src/search/new/interner.rs +++ b/milli/src/search/new/interner.rs @@ -96,7 +96,7 @@ impl FixedSizeInterner { pub fn len(&self) -> u16 { self.stable_store.len() as u16 } - pub fn map(&self, map_f: impl Fn(&T) -> U) -> MappedInterner { + pub fn map(&self, map_f: impl Fn(&T) -> U) -> MappedInterner { MappedInterner { stable_store: self.stable_store.iter().map(map_f).collect(), _phantom: PhantomData, @@ -119,19 +119,19 @@ impl FixedSizeInterner { /// /// Values in this interner are indexed with [`Interned`]. #[derive(Clone)] -pub struct MappedInterner { +pub struct MappedInterner { stable_store: Vec, _phantom: PhantomData, } -impl MappedInterner { +impl MappedInterner { pub fn get(&self, interned: Interned) -> &T { &self.stable_store[interned.idx as usize] } pub fn get_mut(&mut self, interned: Interned) -> &mut T { &mut self.stable_store[interned.idx as usize] } - pub fn map(&self, map_f: impl Fn(&T) -> U) -> MappedInterner { + pub fn map(&self, map_f: impl Fn(&T) -> U) -> MappedInterner { MappedInterner { stable_store: self.stable_store.iter().map(map_f).collect(), _phantom: PhantomData, diff --git a/milli/src/search/new/logger/detailed.rs b/milli/src/search/new/logger/detailed.rs index b519ca659..45a74a585 100644 --- a/milli/src/search/new/logger/detailed.rs +++ b/milli/src/search/new/logger/detailed.rs @@ -44,7 +44,7 @@ pub enum SearchEvents { paths: Vec>>, dead_ends_cache: DeadEndsCache, universe: RoaringBitmap, - distances: MappedInterner, QueryNode>, + distances: MappedInterner>, cost: u16, }, TypoState { @@ -52,7 +52,7 @@ pub enum SearchEvents { paths: Vec>>, dead_ends_cache: DeadEndsCache, universe: RoaringBitmap, - distances: MappedInterner, QueryNode>, + distances: MappedInterner>, cost: u16, }, RankingRuleSkipBucket { @@ -170,7 +170,7 @@ impl SearchLogger for DetailedSearchLogger { paths_map: &[Vec>], dead_ends_cache: &DeadEndsCache, universe: &RoaringBitmap, - distances: &MappedInterner, QueryNode>, + distances: &MappedInterner>, cost: u16, ) { self.events.push(SearchEvents::ProximityState { @@ -189,7 +189,7 @@ impl SearchLogger for DetailedSearchLogger { paths_map: &[Vec>], dead_ends_cache: &DeadEndsCache, universe: &RoaringBitmap, - distances: &MappedInterner, QueryNode>, + distances: &MappedInterner>, cost: u16, ) { self.events.push(SearchEvents::TypoState { @@ -525,7 +525,7 @@ shape: class" graph: &RankingRuleGraph, paths: &[Vec>], _dead_ends_cache: &DeadEndsCache, - distances: MappedInterner, QueryNode>, + distances: MappedInterner>, file: &mut File, ) { writeln!(file, "direction: right").unwrap(); diff --git a/milli/src/search/new/logger/mod.rs b/milli/src/search/new/logger/mod.rs index 203ac7b56..3b8642cab 100644 --- a/milli/src/search/new/logger/mod.rs +++ b/milli/src/search/new/logger/mod.rs @@ -67,7 +67,7 @@ pub trait SearchLogger { paths: &[Vec>], dead_ends_cache: &DeadEndsCache, universe: &RoaringBitmap, - distances: &MappedInterner, QueryNode>, + distances: &MappedInterner>, cost: u16, ); @@ -78,7 +78,7 @@ pub trait SearchLogger { paths: &[Vec>], dead_ends_cache: &DeadEndsCache, universe: &RoaringBitmap, - distances: &MappedInterner, QueryNode>, + distances: &MappedInterner>, cost: u16, ); } @@ -138,7 +138,7 @@ impl SearchLogger for DefaultSearchLogger { _paths_map: &[Vec>], _dead_ends_cache: &DeadEndsCache, _universe: &RoaringBitmap, - _distances: &MappedInterner, QueryNode>, + _distances: &MappedInterner>, _cost: u16, ) { } @@ -149,7 +149,7 @@ impl SearchLogger for DefaultSearchLogger { _paths: &[Vec>], _dead_ends_cache: &DeadEndsCache, _universe: &RoaringBitmap, - _distances: &MappedInterner, QueryNode>, + _distances: &MappedInterner>, _cost: u16, ) { } diff --git a/milli/src/search/new/ranking_rule_graph/cheapest_paths.rs b/milli/src/search/new/ranking_rule_graph/cheapest_paths.rs index c340ef8c7..c09f6e5e0 100644 --- a/milli/src/search/new/ranking_rule_graph/cheapest_paths.rs +++ b/milli/src/search/new/ranking_rule_graph/cheapest_paths.rs @@ -14,7 +14,7 @@ impl RankingRuleGraph { &mut self, from: Interned, cost: u16, - all_distances: &MappedInterner, QueryNode>, + all_distances: &MappedInterner>, dead_ends_cache: &mut DeadEndsCache, mut visit: impl FnMut( &[Interned], @@ -38,7 +38,7 @@ impl RankingRuleGraph { &mut self, from: Interned, cost: u16, - all_distances: &MappedInterner, QueryNode>, + all_distances: &MappedInterner>, dead_ends_cache: &mut DeadEndsCache, visit: &mut impl FnMut( &[Interned], @@ -137,7 +137,7 @@ impl RankingRuleGraph { Ok(any_valid) } - pub fn initialize_distances_with_necessary_edges(&self) -> MappedInterner, QueryNode> { + pub fn initialize_distances_with_necessary_edges(&self) -> MappedInterner> { let mut distances_to_end = self.query_graph.nodes.map(|_| vec![]); let mut enqueued = SmallBitmap::new(self.query_graph.nodes.len()); diff --git a/milli/src/search/new/ranking_rule_graph/mod.rs b/milli/src/search/new/ranking_rule_graph/mod.rs index 129590088..34363febe 100644 --- a/milli/src/search/new/ranking_rule_graph/mod.rs +++ b/milli/src/search/new/ranking_rule_graph/mod.rs @@ -114,7 +114,7 @@ pub trait RankingRuleGraphTrait: Sized { paths: &[Vec>], dead_ends_cache: &DeadEndsCache, universe: &RoaringBitmap, - distances: &MappedInterner, QueryNode>, + distances: &MappedInterner>, cost: u16, logger: &mut dyn SearchLogger, ); @@ -127,7 +127,7 @@ pub trait RankingRuleGraphTrait: Sized { pub struct RankingRuleGraph { pub query_graph: QueryGraph, pub edges_store: FixedSizeInterner>>, - pub edges_of_node: MappedInterner>>, QueryNode>, + pub edges_of_node: MappedInterner>>>, pub conditions_interner: FixedSizeInterner, } impl Clone for RankingRuleGraph { diff --git a/milli/src/search/new/ranking_rule_graph/proximity/mod.rs b/milli/src/search/new/ranking_rule_graph/proximity/mod.rs index 4c058ac8e..568a2c2b0 100644 --- a/milli/src/search/new/ranking_rule_graph/proximity/mod.rs +++ b/milli/src/search/new/ranking_rule_graph/proximity/mod.rs @@ -67,7 +67,7 @@ impl RankingRuleGraphTrait for ProximityGraph { paths: &[Vec>], dead_ends_cache: &DeadEndsCache, universe: &RoaringBitmap, - distances: &MappedInterner, QueryNode>, + distances: &MappedInterner>, cost: u16, logger: &mut dyn SearchLogger, ) { diff --git a/milli/src/search/new/ranking_rule_graph/typo/mod.rs b/milli/src/search/new/ranking_rule_graph/typo/mod.rs index 6b8fc1154..a32274954 100644 --- a/milli/src/search/new/ranking_rule_graph/typo/mod.rs +++ b/milli/src/search/new/ranking_rule_graph/typo/mod.rs @@ -138,7 +138,7 @@ impl RankingRuleGraphTrait for TypoGraph { paths: &[Vec>], dead_ends_cache: &DeadEndsCache, universe: &RoaringBitmap, - distances: &MappedInterner, QueryNode>, + distances: &MappedInterner>, cost: u16, logger: &mut dyn SearchLogger, ) {