This commit is contained in:
Louis Dureuil 2023-07-12 10:08:29 +02:00
parent 177e6e27f9
commit 74315b4ea8
No known key found for this signature in database

View File

@ -85,7 +85,12 @@ impl<'ctx> SearchContext<'ctx> {
let searchable_names = self.index.searchable_fields(self.txn)?; let searchable_names = self.index.searchable_fields(self.txn)?;
let mut restricted_fids = Vec::new(); let mut restricted_fids = Vec::new();
let mut contains_wildcard = false;
for field_name in searchable_attributes { for field_name in searchable_attributes {
if field_name == "*" {
contains_wildcard = true;
continue;
}
let searchable_contains_name = let searchable_contains_name =
searchable_names.as_ref().map(|sn| sn.iter().any(|name| name == field_name)); searchable_names.as_ref().map(|sn| sn.iter().any(|name| name == field_name));
let fid = match (fids_map.id(field_name), searchable_contains_name) { let fid = match (fids_map.id(field_name), searchable_contains_name) {
@ -132,7 +137,7 @@ impl<'ctx> SearchContext<'ctx> {
restricted_fids.push(fid); restricted_fids.push(fid);
} }
self.restricted_fids = Some(restricted_fids); self.restricted_fids = (!contains_wildcard).then_some(restricted_fids);
Ok(()) Ok(())
} }