mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-27 07:14:26 +01:00
Merge #378
378: Hotfix meilisearch#1707 r=Kerollmops a=ManyTheFish This PR contains an ugly quick fix of [meilisearch#1707](https://github.com/meilisearch/MeiliSearch/issues/1707). - remove comparison reverse on rank. Enhancing relevancy and performances - iterate over level 0 only. Enhancing performances. A better fix is in development. Co-authored-by: many <maxime@meilisearch.com> Co-authored-by: Many <legendre.maxime.isn@gmail.com>
This commit is contained in:
commit
6a057a3bd0
@ -192,7 +192,9 @@ impl<'t, 'q> WordLevelIterator<'t, 'q> {
|
|||||||
in_prefix_cache: bool,
|
in_prefix_cache: bool,
|
||||||
) -> heed::Result<Option<Self>> {
|
) -> heed::Result<Option<Self>> {
|
||||||
match ctx.word_position_last_level(&word, in_prefix_cache)? {
|
match ctx.word_position_last_level(&word, in_prefix_cache)? {
|
||||||
Some(level) => {
|
Some(_) => {
|
||||||
|
// HOTFIX Meilisearch#1707: it is better to only iterate over level 0 for performances reasons.
|
||||||
|
let level = TreeLevel::min_value();
|
||||||
let interval_size = LEVEL_EXPONENTIATION_BASE.pow(Into::<u8>::into(level) as u32);
|
let interval_size = LEVEL_EXPONENTIATION_BASE.pow(Into::<u8>::into(level) as u32);
|
||||||
let inner =
|
let inner =
|
||||||
ctx.word_position_iterator(&word, level, in_prefix_cache, None, None)?;
|
ctx.word_position_iterator(&word, level, in_prefix_cache, None, None)?;
|
||||||
@ -528,10 +530,10 @@ impl<'t, 'q> Branch<'t, 'q> {
|
|||||||
fn cmp(&self, other: &Self) -> Ordering {
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
let self_rank = self.compute_rank();
|
let self_rank = self.compute_rank();
|
||||||
let other_rank = other.compute_rank();
|
let other_rank = other.compute_rank();
|
||||||
let left_cmp = self_rank.cmp(&other_rank).reverse();
|
let left_cmp = self_rank.cmp(&other_rank);
|
||||||
// on level: lower is better,
|
// on level: lower is better,
|
||||||
// we want to dig faster into levels on interesting branches.
|
// we want to dig faster into levels on interesting branches.
|
||||||
let level_cmp = self.tree_level.cmp(&other.tree_level).reverse();
|
let level_cmp = self.tree_level.cmp(&other.tree_level);
|
||||||
|
|
||||||
left_cmp.then(level_cmp).then(self.last_result.2.len().cmp(&other.last_result.2.len()))
|
left_cmp.then(level_cmp).then(self.last_result.2.len().cmp(&other.last_result.2.len()))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user