From cb5c77e5367388adf60d4739f5997eeab7132531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 24 Oct 2019 14:20:07 +0200 Subject: [PATCH] Make sure that automatons group with more automatons are better --- meilidb-core/src/automaton/mod.rs | 6 +++++- meilidb-core/src/update/clear_all.rs | 5 +---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/meilidb-core/src/automaton/mod.rs b/meilidb-core/src/automaton/mod.rs index d9c7fcee1..090232421 100644 --- a/meilidb-core/src/automaton/mod.rs +++ b/meilidb-core/src/automaton/mod.rs @@ -284,7 +284,11 @@ fn generate_automatons( // we keep the original automatons at the front. automatons[1..].sort_by_key(|group| { let a = group.automatons.first().unwrap(); - (Reverse(a.is_exact), a.ngram) + ( + Reverse(a.is_exact), + a.ngram, + Reverse(group.automatons.len()), + ) }); Ok((automatons, enhancer_builder.build())) diff --git a/meilidb-core/src/update/clear_all.rs b/meilidb-core/src/update/clear_all.rs index b4b1ab9bd..1612f11d2 100644 --- a/meilidb-core/src/update/clear_all.rs +++ b/meilidb-core/src/update/clear_all.rs @@ -1,8 +1,5 @@ -use meilidb_schema::{Diff, Schema}; - -use crate::update::documents_addition::reindex_all_documents; use crate::update::{next_update_id, Update}; -use crate::{error::UnsupportedOperation, store, MResult, RankedMap}; +use crate::{store, MResult, RankedMap}; pub fn apply_clear_all( writer: &mut heed::RwTxn,