From 9991152bbe2607e584860afc845a49fa901496ca Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Wed, 13 Dec 2023 11:46:09 +0100 Subject: [PATCH] Add TODOs --- meilisearch/src/search.rs | 4 ++++ milli/src/search/hybrid.rs | 1 + milli/src/search/mod.rs | 1 + 3 files changed, 6 insertions(+) diff --git a/meilisearch/src/search.rs b/meilisearch/src/search.rs index 53f6140fb..7bf8ea160 100644 --- a/meilisearch/src/search.rs +++ b/meilisearch/src/search.rs @@ -90,6 +90,7 @@ pub struct SearchQuery { #[derive(Debug, Clone, Default, PartialEq, Deserr)] #[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)] pub struct HybridQuery { + /// TODO validate that sementic ratio is between 0.0 and 1,0 #[deserr(default, error = DeserrJsonError, default = DEFAULT_SEMANTIC_RATIO())] pub semantic_ratio: f32, #[deserr(default, error = DeserrJsonError, default)] @@ -452,6 +453,9 @@ pub fn perform_search( let (search, is_finite_pagination, max_total_hits, offset) = prepare_search(index, &rtxn, &query, features)?; + /// TODO: Change if-cond to query.hybrid.is_some + /// + < 1.0 or remove q + /// + > 0.0 or remove vector let milli::SearchResult { documents_ids, matching_words, candidates, document_scores, .. } = if query.q.is_some() && query.vector.is_some() { search.execute_hybrid()? diff --git a/milli/src/search/hybrid.rs b/milli/src/search/hybrid.rs index cbec20c65..129857fb5 100644 --- a/milli/src/search/hybrid.rs +++ b/milli/src/search/hybrid.rs @@ -252,6 +252,7 @@ impl<'a> Search<'a> { // can unwrap because we returned already if there was no vector query self.vector_results_for_keyword(search.vector.as_ref().unwrap(), &keyword_results)?; + /// TODO apply sementic ratio let keyword_results = CombinedSearchResult::new(keyword_results, vector_results_for_keyword); let vector_results = CombinedSearchResult::new(vector_results, keyword_results_for_vector); diff --git a/milli/src/search/mod.rs b/milli/src/search/mod.rs index 04a6005e3..44fb3556f 100644 --- a/milli/src/search/mod.rs +++ b/milli/src/search/mod.rs @@ -50,6 +50,7 @@ pub struct Search<'a> { scoring_strategy: ScoringStrategy, words_limit: usize, exhaustive_number_hits: bool, + /// TODO: Add semantic ratio or pass it directly to execute_hybrid() rtxn: &'a heed::RoTxn<'a>, index: &'a Index, distribution_shift: Option,