From daa4138df9fd3484a0f3b53d236e40409e8b1fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Mon, 8 May 2023 13:06:35 +0200 Subject: [PATCH] Adjust costs of edges in position ranking rule To ensure good performance --- .../new/ranking_rule_graph/position/mod.rs | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/milli/src/search/new/ranking_rule_graph/position/mod.rs b/milli/src/search/new/ranking_rule_graph/position/mod.rs index d4640097e..9b0b6478f 100644 --- a/milli/src/search/new/ranking_rule_graph/position/mod.rs +++ b/milli/src/search/new/ranking_rule_graph/position/mod.rs @@ -111,23 +111,16 @@ impl RankingRuleGraphTrait for PositionGraph { fn cost_from_position(sum_positions: u32) -> u32 { match sum_positions { - 0 | 1 | 2 | 3 => sum_positions, - 4 | 5 => 4, - 6 | 7 => 5, - 8 | 9 => 6, - 10 | 11 => 7, - 12 | 13 => 8, - 14 | 15 => 9, - 16 | 17..=24 => 10, - 25..=32 => 11, - 33..=64 => 12, - 65..=128 => 13, - 129..=256 => 14, - 257..=512 => 15, - 513..=1024 => 16, - 1025..=2048 => 17, - 2049..=4096 => 18, - 4097..=8192 => 19, - _ => 20, + 0 => 0, + 1 => 1, + 2..=4 => 2, + 5..=7 => 3, + 8..=11 => 4, + 12..=16 => 5, + 17..=24 => 6, + 25..=64 => 7, + 65..=256 => 8, + 257..=1024 => 9, + _ => 10, } }