mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
First batch of PR comment
This commit is contained in:
parent
32bcacefd5
commit
36962b943b
16 changed files with 18 additions and 531 deletions
|
@ -102,6 +102,7 @@ impl Metadata {
|
|||
rules: &'rules [LocalizedAttributesRule],
|
||||
) -> Option<&'rules [Language]> {
|
||||
let localized_attributes_rule_id = self.localized_attributes_rule_id?.get();
|
||||
// - 1: `localized_attributes_rule_id` is NonZero
|
||||
let rule = rules.get((localized_attributes_rule_id - 1) as usize).unwrap();
|
||||
Some(rule.locales())
|
||||
}
|
||||
|
@ -160,6 +161,7 @@ impl MetadataBuilder {
|
|||
.iter()
|
||||
.flat_map(|v| v.iter())
|
||||
.position(|rule| rule.match_str(field))
|
||||
// saturating_add(1): make `id` `NonZero`
|
||||
.map(|id| NonZeroU16::new(id.saturating_add(1).try_into().unwrap()).unwrap());
|
||||
|
||||
Metadata { searchable, filterable, sortable, localized_attributes_rule_id }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue