mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-27 07:00:05 +01:00
Introduce the attribute ranking rule in the list of ranking rules
This commit is contained in:
parent
5230ddb3ea
commit
df0d9bb878
@ -44,8 +44,8 @@ use super::interner::{Interned, MappedInterner};
|
|||||||
use super::logger::SearchLogger;
|
use super::logger::SearchLogger;
|
||||||
use super::query_graph::QueryNode;
|
use super::query_graph::QueryNode;
|
||||||
use super::ranking_rule_graph::{
|
use super::ranking_rule_graph::{
|
||||||
ConditionDocIdsCache, DeadEndsCache, ExactnessGraph, ProximityGraph, RankingRuleGraph,
|
AttributeGraph, ConditionDocIdsCache, DeadEndsCache, ExactnessGraph, ProximityGraph,
|
||||||
RankingRuleGraphTrait, TypoGraph,
|
RankingRuleGraph, RankingRuleGraphTrait, TypoGraph,
|
||||||
};
|
};
|
||||||
use super::small_bitmap::SmallBitmap;
|
use super::small_bitmap::SmallBitmap;
|
||||||
use super::{QueryGraph, RankingRule, RankingRuleOutput, SearchContext};
|
use super::{QueryGraph, RankingRule, RankingRuleOutput, SearchContext};
|
||||||
@ -59,6 +59,12 @@ impl GraphBasedRankingRule<ProximityGraph> {
|
|||||||
Self::new_with_id("proximity".to_owned(), terms_matching_strategy)
|
Self::new_with_id("proximity".to_owned(), terms_matching_strategy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub type Attribute = GraphBasedRankingRule<AttributeGraph>;
|
||||||
|
impl GraphBasedRankingRule<AttributeGraph> {
|
||||||
|
pub fn new(terms_matching_strategy: Option<TermsMatchingStrategy>) -> Self {
|
||||||
|
Self::new_with_id("attribute".to_owned(), terms_matching_strategy)
|
||||||
|
}
|
||||||
|
}
|
||||||
pub type Typo = GraphBasedRankingRule<TypoGraph>;
|
pub type Typo = GraphBasedRankingRule<TypoGraph>;
|
||||||
impl GraphBasedRankingRule<TypoGraph> {
|
impl GraphBasedRankingRule<TypoGraph> {
|
||||||
pub fn new(terms_matching_strategy: Option<TermsMatchingStrategy>) -> Self {
|
pub fn new(terms_matching_strategy: Option<TermsMatchingStrategy>) -> Self {
|
||||||
|
@ -28,7 +28,7 @@ use std::collections::HashSet;
|
|||||||
use bucket_sort::bucket_sort;
|
use bucket_sort::bucket_sort;
|
||||||
use charabia::TokenizerBuilder;
|
use charabia::TokenizerBuilder;
|
||||||
use db_cache::DatabaseCache;
|
use db_cache::DatabaseCache;
|
||||||
use graph_based_ranking_rule::{Proximity, Typo};
|
use graph_based_ranking_rule::{Attribute, Proximity, Typo};
|
||||||
use heed::RoTxn;
|
use heed::RoTxn;
|
||||||
use interner::DedupInterner;
|
use interner::DedupInterner;
|
||||||
pub use logger::visual::VisualSearchLogger;
|
pub use logger::visual::VisualSearchLogger;
|
||||||
@ -174,7 +174,7 @@ fn get_ranking_rules_for_query_graph_search<'ctx>(
|
|||||||
let mut typo = false;
|
let mut typo = false;
|
||||||
let mut proximity = false;
|
let mut proximity = false;
|
||||||
let mut sort = false;
|
let mut sort = false;
|
||||||
let attribute = false;
|
let mut attribute = false;
|
||||||
let mut exactness = false;
|
let mut exactness = false;
|
||||||
let mut asc = HashSet::new();
|
let mut asc = HashSet::new();
|
||||||
let mut desc = HashSet::new();
|
let mut desc = HashSet::new();
|
||||||
@ -222,8 +222,8 @@ fn get_ranking_rules_for_query_graph_search<'ctx>(
|
|||||||
if attribute {
|
if attribute {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// todo!();
|
attribute = true;
|
||||||
// attribute = false;
|
ranking_rules.push(Box::new(Attribute::new(None)));
|
||||||
}
|
}
|
||||||
crate::Criterion::Sort => {
|
crate::Criterion::Sort => {
|
||||||
if sort {
|
if sort {
|
||||||
|
@ -10,17 +10,18 @@ mod cheapest_paths;
|
|||||||
mod condition_docids_cache;
|
mod condition_docids_cache;
|
||||||
mod dead_ends_cache;
|
mod dead_ends_cache;
|
||||||
|
|
||||||
|
/// Implementation of the `attribute` ranking rule
|
||||||
|
mod attribute;
|
||||||
/// Implementation of the `exactness` ranking rule
|
/// Implementation of the `exactness` ranking rule
|
||||||
mod exactness;
|
mod exactness;
|
||||||
/// Implementation of the `proximity` ranking rule
|
/// Implementation of the `proximity` ranking rule
|
||||||
mod proximity;
|
mod proximity;
|
||||||
/// Implementation of the `typo` ranking rule
|
/// Implementation of the `typo` ranking rule
|
||||||
mod typo;
|
mod typo;
|
||||||
/// Implementation of the `attribute` ranking rule
|
|
||||||
mod attribute;
|
|
||||||
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
|
pub use attribute::{AttributeCondition, AttributeGraph};
|
||||||
pub use cheapest_paths::PathVisitor;
|
pub use cheapest_paths::PathVisitor;
|
||||||
pub use condition_docids_cache::ConditionDocIdsCache;
|
pub use condition_docids_cache::ConditionDocIdsCache;
|
||||||
pub use dead_ends_cache::DeadEndsCache;
|
pub use dead_ends_cache::DeadEndsCache;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user