Fix tests

This commit is contained in:
Mubelotix
2025-08-05 15:55:31 +02:00
parent 2f5101a1e4
commit c385cf985b
5 changed files with 12 additions and 16 deletions

View File

@ -1056,6 +1056,7 @@ pub fn prepare_search<'t>(
.map(|x| x as usize)
.unwrap_or(DEFAULT_PAGINATION_MAX_TOTAL_HITS);
search.retrieve_vectors(query.retrieve_vectors);
search.exhaustive_number_hits(is_finite_pagination);
search.max_total_hits(Some(max_total_hits));
search.scoring_strategy(

View File

@ -327,11 +327,6 @@ async fn binary_quantize_clear_documents() {
{
"hits": [],
"query": "",
"queryVector": [
1.0,
1.0,
1.0
],
"processingTimeMs": "[duration]",
"limit": 20,
"offset": 0,

View File

@ -690,11 +690,6 @@ async fn clear_documents() {
{
"hits": [],
"query": "",
"queryVector": [
1.0,
1.0,
1.0
],
"processingTimeMs": "[duration]",
"limit": 20,
"offset": 0,
@ -754,11 +749,6 @@ async fn add_remove_one_vector_4588() {
}
],
"query": "",
"queryVector": [
1.0,
1.0,
1.0
],
"processingTimeMs": "[duration]",
"limit": 20,
"offset": 0,

View File

@ -212,6 +212,7 @@ impl Search<'_> {
terms_matching_strategy: self.terms_matching_strategy,
scoring_strategy: ScoringStrategy::Detailed,
words_limit: self.words_limit,
retrieve_vectors: self.retrieve_vectors,
exhaustive_number_hits: self.exhaustive_number_hits,
max_total_hits: self.max_total_hits,
rtxn: self.rtxn,

View File

@ -53,6 +53,7 @@ pub struct Search<'a> {
terms_matching_strategy: TermsMatchingStrategy,
scoring_strategy: ScoringStrategy,
words_limit: usize,
retrieve_vectors: bool,
exhaustive_number_hits: bool,
max_total_hits: Option<usize>,
rtxn: &'a heed::RoTxn<'a>,
@ -76,6 +77,7 @@ impl<'a> Search<'a> {
geo_param: GeoSortParameter::default(),
terms_matching_strategy: TermsMatchingStrategy::default(),
scoring_strategy: Default::default(),
retrieve_vectors: false,
exhaustive_number_hits: false,
max_total_hits: None,
words_limit: 10,
@ -188,6 +190,11 @@ impl<'a> Search<'a> {
self
}
pub fn retrieve_vectors(&mut self, retrieve_vectors: bool) -> &mut Search<'a> {
self.retrieve_vectors = retrieve_vectors;
self
}
/// Forces the search to exhaustively compute the number of candidates,
/// this will increase the search time but allows finite pagination.
pub fn exhaustive_number_hits(&mut self, exhaustive_number_hits: bool) -> &mut Search<'a> {
@ -277,7 +284,7 @@ impl<'a> Search<'a> {
quantized,
media: _,
}) => {
if *auto_embedded {
if *auto_embedded && self.retrieve_vectors {
query_vector = Some(vector.clone());
}
execute_vector_search(
@ -359,6 +366,7 @@ impl fmt::Debug for Search<'_> {
terms_matching_strategy,
scoring_strategy,
words_limit,
retrieve_vectors,
exhaustive_number_hits,
max_total_hits,
rtxn: _,
@ -379,6 +387,7 @@ impl fmt::Debug for Search<'_> {
.field("searchable_attributes", searchable_attributes)
.field("terms_matching_strategy", terms_matching_strategy)
.field("scoring_strategy", scoring_strategy)
.field("retrieve_vectors", retrieve_vectors)
.field("exhaustive_number_hits", exhaustive_number_hits)
.field("max_total_hits", max_total_hits)
.field("words_limit", words_limit)