mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
Adjust costs of edges in position ranking rule
To ensure good performance
This commit is contained in:
parent
65ad8cce36
commit
f6524a6858
@ -111,23 +111,16 @@ impl RankingRuleGraphTrait for PositionGraph {
|
|||||||
|
|
||||||
fn cost_from_position(sum_positions: u32) -> u32 {
|
fn cost_from_position(sum_positions: u32) -> u32 {
|
||||||
match sum_positions {
|
match sum_positions {
|
||||||
0 | 1 | 2 | 3 => sum_positions,
|
0 => 0,
|
||||||
4 | 5 => 4,
|
1 => 1,
|
||||||
6 | 7 => 5,
|
2..=4 => 2,
|
||||||
8 | 9 => 6,
|
5..=7 => 3,
|
||||||
10 | 11 => 7,
|
8..=11 => 4,
|
||||||
12 | 13 => 8,
|
12..=16 => 5,
|
||||||
14 | 15 => 9,
|
17..=24 => 6,
|
||||||
16 | 17..=24 => 10,
|
25..=64 => 7,
|
||||||
25..=32 => 11,
|
65..=256 => 8,
|
||||||
33..=64 => 12,
|
257..=1024 => 9,
|
||||||
65..=128 => 13,
|
_ => 10,
|
||||||
129..=256 => 14,
|
|
||||||
257..=512 => 15,
|
|
||||||
513..=1024 => 16,
|
|
||||||
1025..=2048 => 17,
|
|
||||||
2049..=4096 => 18,
|
|
||||||
4097..=8192 => 19,
|
|
||||||
_ => 20,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user