Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.1
-
MOODLE_31_STABLE
-
MOODLE_31_STABLE
-
MDL-53354-master -
Description
We are looking at adding search indexing support to a plugin, and while it technically possible, there is a significant performance problem. Here is the scenario:
We have a course specific email module, which provides basically webmail that happens totally within a Moodle course. We would like to index all the emails into search.
The problem happens when a search is done. Right now, the only limiting/filtering is done by context, so when a search happens, all matching emails in the course are returned, and we have to check each one to see if they have access. The problem is that the hit to miss ratio is VERY low, since generally only 2 users in a course have access to a particular message.
What I propose is adding a field to the schema, something like alloweduserid. It's set to 0 by default, or a search area can set it when building a doc. Then on all searches add alloweduserid:(0 OR $USER->id) to every query, just like we add context filtering.