Rename the SearchForFacetValues struct

This commit is contained in:
Clément Renault 2023-04-27 10:43:02 +02:00 committed by Louis Dureuil
parent aadbe88048
commit 55c17aa38b
No known key found for this signature in database
3 changed files with 9 additions and 8 deletions

View File

@ -14,7 +14,7 @@ use meilisearch_types::heed::RoTxn;
use meilisearch_types::index_uid::IndexUid; use meilisearch_types::index_uid::IndexUid;
use meilisearch_types::milli::score_details::{ScoreDetails, ScoringStrategy}; use meilisearch_types::milli::score_details::{ScoreDetails, ScoringStrategy};
use meilisearch_types::milli::{ use meilisearch_types::milli::{
dot_product_similarity, FacetValueHit, InternalError, SearchForFacetValue, dot_product_similarity, FacetValueHit, InternalError, SearchForFacetValues,
}; };
use meilisearch_types::settings::DEFAULT_PAGINATION_MAX_TOTAL_HITS; use meilisearch_types::settings::DEFAULT_PAGINATION_MAX_TOTAL_HITS;
use meilisearch_types::{milli, Document}; use meilisearch_types::{milli, Document};
@ -590,7 +590,7 @@ pub fn perform_facet_search(
let rtxn = index.read_txn()?; let rtxn = index.read_txn()?;
let (search, _, _, _) = prepare_search(index, &rtxn, &search_query)?; let (search, _, _, _) = prepare_search(index, &rtxn, &search_query)?;
let mut facet_search = SearchForFacetValue::new(facet_name, search); let mut facet_search = SearchForFacetValues::new(facet_name, search);
if let Some(facet_query) = &facet_query { if let Some(facet_query) = &facet_query {
facet_search.query(facet_query); facet_search.query(facet_query);
} }

View File

@ -58,7 +58,7 @@ pub use self::heed_codec::{
pub use self::index::Index; pub use self::index::Index;
pub use self::search::{ pub use self::search::{
FacetDistribution, FacetValueHit, Filter, FormatOptions, MatchBounds, MatcherBuilder, FacetDistribution, FacetValueHit, Filter, FormatOptions, MatchBounds, MatcherBuilder,
MatchingWords, Search, SearchForFacetValue, SearchResult, TermsMatchingStrategy, MatchingWords, Search, SearchForFacetValues, SearchResult, TermsMatchingStrategy,
DEFAULT_VALUES_PER_FACET, DEFAULT_VALUES_PER_FACET,
}; };

View File

@ -13,7 +13,8 @@ use crate::error::UserError;
use crate::heed_codec::facet::{FacetGroupKey, FacetGroupValue}; use crate::heed_codec::facet::{FacetGroupKey, FacetGroupValue};
use crate::score_details::{ScoreDetails, ScoringStrategy}; use crate::score_details::{ScoreDetails, ScoringStrategy};
use crate::{ use crate::{
execute_search, AscDesc, DefaultSearchLogger, DocumentId, Index, Result, SearchContext, BEU16, execute_search, AscDesc, DefaultSearchLogger, DocumentId, FieldIdMapMissingEntry, Index,
Result, SearchContext, BEU16,
}; };
// Building these factories is not free. // Building these factories is not free.
@ -241,15 +242,15 @@ pub fn build_dfa(word: &str, typos: u8, is_prefix: bool) -> DFA {
} }
} }
pub struct SearchForFacetValue<'a> { pub struct SearchForFacetValues<'a> {
query: Option<String>, query: Option<String>,
facet: String, facet: String,
search_query: Search<'a>, search_query: Search<'a>,
} }
impl<'a> SearchForFacetValue<'a> { impl<'a> SearchForFacetValues<'a> {
pub fn new(facet: String, search_query: Search<'a>) -> SearchForFacetValue<'a> { pub fn new(facet: String, search_query: Search<'a>) -> SearchForFacetValues<'a> {
SearchForFacetValue { query: None, facet, search_query } SearchForFacetValues { query: None, facet, search_query }
} }
pub fn query(&mut self, query: impl Into<String>) -> &mut Self { pub fn query(&mut self, query: impl Into<String>) -> &mut Self {