mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-29 18:04:47 +00:00
Merge remote-tracking branch 'origin/search-refactor-tests-doc' into search-refactor
This commit is contained in:
@ -57,9 +57,7 @@ impl RankingRuleGraphTrait for ProximityGraph {
|
||||
Ok(format!("{cost}: cost"))
|
||||
}
|
||||
ProximityCondition::Term { term } => {
|
||||
let original_term = ctx.term_interner.get(term.term_subset.original);
|
||||
let original_word = ctx.word_interner.get(original_term.original);
|
||||
Ok(format!("{original_word} : exists"))
|
||||
Ok(format!("{} : exists", term.term_subset.description(ctx)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use roaring::RoaringBitmap;
|
||||
use super::{ComputedCondition, DeadEndsCache, RankingRuleGraph, RankingRuleGraphTrait};
|
||||
use crate::search::new::interner::{DedupInterner, Interned, MappedInterner};
|
||||
use crate::search::new::logger::SearchLogger;
|
||||
use crate::search::new::query_term::{LocatedQueryTermSubset, NTypoTermSubset};
|
||||
use crate::search::new::query_term::LocatedQueryTermSubset;
|
||||
use crate::search::new::resolve_query_graph::compute_query_term_subset_docids;
|
||||
use crate::search::new::{QueryGraph, QueryNode, SearchContext};
|
||||
use crate::Result;
|
||||
@ -43,8 +43,7 @@ impl RankingRuleGraphTrait for TypoGraph {
|
||||
_from: Option<&LocatedQueryTermSubset>,
|
||||
to_term: &LocatedQueryTermSubset,
|
||||
) -> Result<Vec<(u32, Interned<Self::Condition>)>> {
|
||||
let term = to_term; // LocatedQueryTermSubset { term_subset, positions: _, term_ids } = to_term;
|
||||
let original_full_term = ctx.term_interner.get(term.term_subset.original);
|
||||
let term = to_term;
|
||||
|
||||
let mut edges = vec![];
|
||||
// Ngrams have a base typo cost
|
||||
@ -52,20 +51,20 @@ impl RankingRuleGraphTrait for TypoGraph {
|
||||
// 3-gram -> equivalent to 2 typos
|
||||
let base_cost = if term.term_ids.len() == 1 { 0 } else { term.term_ids.len() as u32 };
|
||||
|
||||
for nbr_typos in 0..=original_full_term.max_nbr_typos {
|
||||
for nbr_typos in 0..=term.term_subset.max_nbr_typos(ctx) {
|
||||
let mut term = term.clone();
|
||||
match nbr_typos {
|
||||
0 => {
|
||||
term.term_subset.one_typo_subset = NTypoTermSubset::Nothing;
|
||||
term.term_subset.two_typo_subset = NTypoTermSubset::Nothing;
|
||||
term.term_subset.clear_one_typo_subset();
|
||||
term.term_subset.clear_two_typo_subset();
|
||||
}
|
||||
1 => {
|
||||
term.term_subset.zero_typo_subset = NTypoTermSubset::Nothing;
|
||||
term.term_subset.two_typo_subset = NTypoTermSubset::Nothing;
|
||||
term.term_subset.clear_zero_typo_subset();
|
||||
term.term_subset.clear_two_typo_subset();
|
||||
}
|
||||
2 => {
|
||||
term.term_subset.zero_typo_subset = NTypoTermSubset::Nothing;
|
||||
term.term_subset.one_typo_subset = NTypoTermSubset::Nothing;
|
||||
term.term_subset.clear_zero_typo_subset();
|
||||
term.term_subset.clear_one_typo_subset();
|
||||
}
|
||||
_ => panic!(),
|
||||
};
|
||||
@ -92,9 +91,6 @@ impl RankingRuleGraphTrait for TypoGraph {
|
||||
|
||||
fn label_for_condition(ctx: &mut SearchContext, condition: &Self::Condition) -> Result<String> {
|
||||
let TypoCondition { term, nbr_typos } = condition;
|
||||
let original_term = ctx.term_interner.get(term.term_subset.original);
|
||||
let original = ctx.word_interner.get(original_term.original);
|
||||
|
||||
Ok(format!("{original}: {nbr_typos}"))
|
||||
Ok(format!("{}: {nbr_typos}", term.term_subset.description(ctx)))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user