mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-11 14:04:31 +01:00
Fix another issue with the nested primary key selector
This commit is contained in:
parent
192793ee38
commit
25e768f31c
@ -256,7 +256,7 @@ impl fmt::Debug for DocumentId {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn contained_in(selector: &str, key: &str) -> bool {
|
fn starts_with(selector: &str, key: &str) -> bool {
|
||||||
selector.strip_prefix(key).map_or(false, |tail| {
|
selector.strip_prefix(key).map_or(false, |tail| {
|
||||||
tail.chars().next().map(|c| c == PRIMARY_KEY_SPLIT_SYMBOL).unwrap_or(true)
|
tail.chars().next().map(|c| c == PRIMARY_KEY_SPLIT_SYMBOL).unwrap_or(true)
|
||||||
})
|
})
|
||||||
@ -282,12 +282,7 @@ pub fn fetch_matching_values_in_object(
|
|||||||
format!("{}{}{}", base_key, PRIMARY_KEY_SPLIT_SYMBOL, key)
|
format!("{}{}{}", base_key, PRIMARY_KEY_SPLIT_SYMBOL, key)
|
||||||
};
|
};
|
||||||
|
|
||||||
// here if the user only specified `doggo` we need to iterate in all the fields of `doggo`
|
if starts_with(selector, &base_key) {
|
||||||
// so we check the contained_in on both side.
|
|
||||||
let should_continue =
|
|
||||||
contained_in(selector, &base_key) || contained_in(&base_key, selector);
|
|
||||||
|
|
||||||
if should_continue {
|
|
||||||
match value {
|
match value {
|
||||||
Value::Object(object) => {
|
Value::Object(object) => {
|
||||||
fetch_matching_values_in_object(object, selector, &base_key, output)
|
fetch_matching_values_in_object(object, selector, &base_key, output)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user