1
0
mirror of https://github.com/meilisearch/MeiliSearch synced 2025-03-13 03:21:39 +01:00

Merge MetadataBuilder::_new into MetadataBuilder::new

This commit is contained in:
ManyTheFish 2025-03-11 15:31:57 +01:00
parent 8790880589
commit a370b467fe

@ -223,7 +223,7 @@ impl MetadataBuilder {
let distinct_attribute = index.distinct_field(rtxn)?.map(|s| s.to_string());
let asc_desc_attributes = index.asc_desc_fields(rtxn)?;
Ok(Self::_new(
Ok(Self::new(
searchable_attributes,
filterable_attributes,
sortable_attributes,
@ -233,7 +233,6 @@ impl MetadataBuilder {
))
}
#[cfg(test)]
/// Build a new `MetadataBuilder` from the given parameters.
///
/// This is used for testing, prefer using `MetadataBuilder::from_index` instead.
@ -244,24 +243,6 @@ impl MetadataBuilder {
localized_attributes: Option<Vec<LocalizedAttributesRule>>,
distinct_attribute: Option<String>,
asc_desc_attributes: HashSet<String>,
) -> Self {
Self::_new(
searchable_attributes,
filterable_attributes,
sortable_attributes,
localized_attributes,
distinct_attribute,
asc_desc_attributes,
)
}
fn _new(
searchable_attributes: Option<Vec<String>>,
filterable_attributes: Vec<FilterableAttributesRule>,
sortable_attributes: HashSet<String>,
localized_attributes: Option<Vec<LocalizedAttributesRule>>,
distinct_attribute: Option<String>,
asc_desc_attributes: HashSet<String>,
) -> Self {
let searchable_attributes = match searchable_attributes {
Some(fields) if fields.iter().any(|f| f == "*") => None,