Global search doesn't index plugins?

Global search doesn't index plugins?

by Roland Sherwood -
Number of replies: 4

Hi. We're in the process of setting up Moodle 3.1 and Solr and have a quick query concerning the scope of the indexing that Solr performs. Basically, we're a little perturbed by the fact that it appears only core Moodle activities and related data is capable of being indexed - while plugins are not.

Below is a screenshot from a 3.1 server where multiple mod plugins have been installed (including, for example, Active Quiz, Attendance, BigBlueButton) which illustrates how indexing of these activities is not possible via the 'Manage global search' administration area:


Am I missing something here? Or does this mean that Global Search is not actually very global, and anyone searching for a specific BigBlueButton or Attendance activity, for example, would not be able to locate it via searching? If so, this seems like a potentially huge flaw in the search approach...

If it is the case that only core activities are indexed, does anyone know if there are plans for this to change?

Average of ratings: Useful (2)
In reply to Roland Sherwood

Re: Global search doesn't index plugins?

by Yezi Yang -

Thank you, Roland. Global search is a big improvement in Moodle 3.1. I also hope this issue can be solved as soon as possible.

Average of ratings: Useful (2)
In reply to Roland Sherwood

Re: Global search doesn't index plugins?

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I thought your statement that global search doesn't support 3rd-party plugins sounded a bit wrong, so I did a bit of digging into the code (I couldn't find any dev docs about this - I was just redirected to the user docs; feel free to correct me if I've missed something).

As I expected, the global search does support all plugins (both core and 3rd-party), but only if that plugin itself declares that it is available for searching. It appears that to do this, the plugin author needs to implement, at the very least, mod/[pluginname]/classes/search/activity.php and, optionally, mod/[pluginname]/classes/search/[other component].php (e.g. the book module allows you to search the content of chapters this way, as well as the content of the main activity).

So, really, the flaw in the system is that the 3rd-party plugins you have mentioned have not (yet) enabled search support themselves (and not that there is an intrinsic problem with global search). Given that Moodle 3.1 has only been out for a short while and there are no Moodle docs (that I have been able to find, after a quick look) to explain to 3rd-party plugin devs how to implement search, it's probably a bit too soon to make a judgement about how useful the global search will be in these cases.


Average of ratings: Useful (6)
In reply to Davo Smith

Re: Global search doesn't index plugins?

by Roland Sherwood -

Many thanks for the reply and clarification Davo - and apologies if I came across as being a bit judgemental about the implementation of search within 3.1 (I'm actually hugely grateful to the developers for what they've put together). However, like you I couldn't find any documentation relating to this issue hence why - based on what I was seeing - I felt it appropriate to raise my concerns here.

Again, thanks for the clarification - I really appreciate it. Here's hoping the developers of the plugins we use will update them fairly soon in order to allow them to become fully searchable.

Average of ratings: Useful (1)
In reply to Roland Sherwood

Re: Global search doesn't index plugins?

by David Monllaó -

Hi Roland,

As Davo explained plugins (any core component as well) can add stuff to the search index, they can do it through the search API (https://docs.moodle.org/dev/Search_API), it is listed along with other core moodle APIs that plugins can use (https://docs.moodle.org/dev/Core_APIs

I will add a section in https://docs.moodle.org/31/en/Global_search explaining what contents are being indexed. Thanks for commenting.

Average of ratings: Useful (1)