Hi all, just an update that we at the OU are planning to contribute a few minor global search improvements for Moodle 3.4. In case anyone has any feedback on any of these (like 'that would be great/terrible/useful/useless'), feel free to let me know here!
A caveat: It's possible that Moodle HQ developers might not like the direction of some of these in which case maybe we can't do them! Although David Monllaó has written a nice comment on the first issue so I'm hopeful...
That said, the first round of planned improvements are:
- Make it possible to search blocks (MDL-58957)
In core this will include searching the HTML block (most of the other blocks don't really have 'content' of their own) but also for third-party blocks could become searchable if they like.
The main issue with this one is that it will be a bit limited as I think we can only easily make it search blocks that are placed directly on course pages. At least it might be possible for somebody else to improve that part later on.
- Allow partial indexing (from the scheduled task)
At the moment unless I've misunderstood it, when the scheduled task to update the index runs, it updates ALL of the index and there is no way to stop it. So for instance, supposing you have a plugin which is not searchable, and you have 1 million items of content in it. You upgrade to the next version of the plugin which is searchable, and you turn on the search area - suddenly the scheduled task is going to try to do 1 million search documents on its next run. That's not great.
You can work around this problem by using the CLI indexing tool but it would be nice if the scheduled task worked better. So I'm proposing to put a time limit on the scheduled task, for example maybe it will run for a maximum of 10 minutes and then stop, and then do another 10 minutes next time it runs (which should basically be within a minute, if you've set up cron the recommended way). With this it would then be nice if it gives priority to keeping up with the latest new content on the existing search areas (that are already current) rather than the one that needs completely re-updating.
- Allow easy Behat testing of search results screens
Basically I would like a nice way to fake search results from inside a behat test, this is because I'm going to make some custom UI into the search system here and I want it to be testable. So this would be a behat step that lets the UI work without having an actual search engine, something like (obviously not a realistic example, it would need more fields):
When global search receives the query "frogs" it returns the following:
| title | summary | url |
| First result |This is the summary text | http://example.org/frogs |
Anyhow I thought i'd let people know. If these go well there might be another round of exciting improvements later, I hope.