diff --git a/meilisearch/src/search.rs b/meilisearch/src/search.rs index 34ebe463d..94690d121 100644 --- a/meilisearch/src/search.rs +++ b/meilisearch/src/search.rs @@ -231,7 +231,7 @@ impl SearchKind { Ok(Self::Hybrid { embedder_name, embedder, semantic_ratio }) } - fn embedder( + pub(crate) fn embedder( index_scheduler: &index_scheduler::IndexScheduler, index: &Index, embedder_name: Option<&str>, diff --git a/milli/examples/search.rs b/milli/examples/search.rs index 3d10ec599..2779f5b15 100644 --- a/milli/examples/search.rs +++ b/milli/examples/search.rs @@ -49,7 +49,7 @@ fn main() -> Result<(), Box> { let start = Instant::now(); let mut ctx = SearchContext::new(&index, &txn)?; - let universe = filtered_universe(&ctx, &None)?; + let universe = filtered_universe(ctx.index, ctx.txn, &None)?; let docs = execute_search( &mut ctx, diff --git a/milli/src/search/mod.rs b/milli/src/search/mod.rs index ca0eda49e..7d1254aa7 100644 --- a/milli/src/search/mod.rs +++ b/milli/src/search/mod.rs @@ -148,7 +148,7 @@ impl<'a> Search<'a> { pub fn execute_for_candidates(&self, has_vector_search: bool) -> Result { if has_vector_search { let ctx = SearchContext::new(self.index, self.rtxn)?; - filtered_universe(&ctx, &self.filter) + filtered_universe(ctx.index, ctx.txn, &self.filter) } else { Ok(self.execute()?.candidates) } @@ -161,7 +161,7 @@ impl<'a> Search<'a> { ctx.attributes_to_search_on(searchable_attributes)?; } - let universe = filtered_universe(&ctx, &self.filter)?; + let universe = filtered_universe(ctx.index, ctx.txn, &self.filter)?; let PartialSearchResult { located_query_terms, candidates, diff --git a/milli/src/search/new/matches/mod.rs b/milli/src/search/new/matches/mod.rs index 40e6f8dc8..f121971b8 100644 --- a/milli/src/search/new/matches/mod.rs +++ b/milli/src/search/new/matches/mod.rs @@ -507,7 +507,7 @@ mod tests { impl<'a> MatcherBuilder<'a> { fn new_test(rtxn: &'a heed::RoTxn, index: &'a TempIndex, query: &str) -> Self { let mut ctx = SearchContext::new(index, rtxn).unwrap(); - let universe = filtered_universe(&ctx, &None).unwrap(); + let universe = filtered_universe(ctx.index, ctx.txn, &None).unwrap(); let crate::search::PartialSearchResult { located_query_terms, .. } = execute_search( &mut ctx, Some(query), diff --git a/milli/src/search/new/mod.rs b/milli/src/search/new/mod.rs index 5e4c2f829..e152dd233 100644 --- a/milli/src/search/new/mod.rs +++ b/milli/src/search/new/mod.rs @@ -543,11 +543,15 @@ fn resolve_sort_criteria<'ctx, Query: RankingRuleQueryTrait>( Ok(()) } -pub fn filtered_universe(ctx: &SearchContext, filters: &Option) -> Result { +pub fn filtered_universe( + index: &Index, + txn: &RoTxn<'_>, + filters: &Option, +) -> Result { Ok(if let Some(filters) = filters { - filters.evaluate(ctx.txn, ctx.index)? + filters.evaluate(txn, index)? } else { - ctx.index.documents_ids(ctx.txn)? + index.documents_ids(txn)? }) }