Add TODOs

This commit is contained in:
ManyTheFish 2023-12-13 11:46:09 +01:00 committed by Louis Dureuil
parent a4536b1381
commit 9991152bbe
No known key found for this signature in database
3 changed files with 6 additions and 0 deletions

View File

@ -90,6 +90,7 @@ pub struct SearchQuery {
#[derive(Debug, Clone, Default, PartialEq, Deserr)]
#[deserr(error = DeserrJsonError<InvalidHybridQuery>, 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<InvalidSemanticRatio>, default = DEFAULT_SEMANTIC_RATIO())]
pub semantic_ratio: f32,
#[deserr(default, error = DeserrJsonError<InvalidEmbedder>, 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()?

View File

@ -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);

View File

@ -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<DistributionShift>,