Apply ACL restriction filters for a search query

We should put `normalizeFlagKey()` in an helper and prevent tight coupling with the unrelated `RecordIndexer`