We are currently deploying moodle global search using SOLR.
We have allocated the moodle/search:query capability to system roles (e.g. admin, manager) and the search works well. Users with those roles can search and see the results.
Now we want teacher and student roles to will be able to search as well, so we've made the same capability allocation, giving those roles the moodle/search:query capability.
however they get an error saying something like "You have no permissions to perform Perform site-wide searches".
looking at /search/index.php code, I see that require_capability is called with the system context.
$context = context_system::instance();
The question is
Is there another way (other to the described code hack) to enable non-system roles to perform global search?
Or in other words: How does Moodle expects that the Teacher and Student roles will perform search if they are not defined as system-roles?
We are probably missing something about allocating moodle/search:query for non-system roles, so if anyone have had such an experience and can clarify the best practice for working this out.