mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-29 09:39:58 +00:00
Add more tests for the attribute ranking rule
This commit is contained in:
@ -77,6 +77,10 @@ impl RankingRuleGraphTrait for PositionGraph {
|
||||
let cost = {
|
||||
let mut cost = 0;
|
||||
for i in 0..term.term_ids.len() {
|
||||
// This is actually not fully correct and slightly penalises ngrams unfairly.
|
||||
// Because if two words are in the same bucketed position (e.g. 32) and consecutive,
|
||||
// then their position cost will be 32+32=64, but an ngram of these two words at the
|
||||
// same position will have a cost of 32+32+1=65
|
||||
cost += position as u32 + i as u32;
|
||||
}
|
||||
cost
|
||||
|
Reference in New Issue
Block a user