Unlocking the Future of AI Agents with Large Language Models
Add your plugin contents to global search
1. MOODLEMOOT AUSTRALIA 2016
MOODLEMOOT AUSTRALIA 2016 - PERTH 27th
- 29th
SEPTEMBER
Presented by David Monllao, Integrator and Senior Analyst
Developer
Add your plugin contents to
global search
2. MOODLEMOOT AUSTRALIA 2016
● Available from Moodle 3.1 onwards
● What is it?
○ A new Search engine plugin type
■ To store Moodle sites’ contents
○ A new Search API
■ So Moodle components can add stuff to
search engines
○ A UI to search the search engine contents
Global Search
3. MOODLEMOOT AUSTRALIA 2016
Search areas
It is what Moodle components need to define
to add contents to the search engine.
● Name it: $string[‘search:stuff’] = ‘My plugin - stuff’;
● Define the context level where your plugin works
○ For partially automated control access
5. MOODLEMOOT AUSTRALIA 2016
● get_recordset_by_timestamp($modifiedfrom = 0)
○ Retrieve your documents data and return them as a
recordset
● get_document($record, $options = array)
○ Called for each recordset record
○ Map your $record attributes to
core_searchdocument fields
https://docs.moodle.org/dev/Search_API#Index_data
Index data
6. MOODLEMOOT AUSTRALIA 2016
● Search manager partially automates documents
security checkings
○ Course: Enrolled and visible (or viewhiddencourses)
○ Activities: Visible for the user (cm_info->uservisible)
○ User: The current user
● A query filter is automatically added by the search
manager
https://docs.moodle.org/dev/Search_API#Access_control
Access control
7. MOODLEMOOT AUSTRALIA 2016
● core_searchbase::check_access
○ Runs once results are returned from the search
engine
○ Restrictions depend on your plugins’ logic
■ e.g. Approved entries
■ Internal tables groupid fields
https://docs.moodle.org/dev/Search_API#Access_control
Access control
8. MOODLEMOOT AUSTRALIA 2016
● Will index your activities’ name and description
● Abstract class does all the stuff for you
○ https://github.com/moodle/moodle/blob/master/search/classes/b
ase_activity.php (search/classes/area/base_activity.php in 3.1)
https://docs.moodle.org/dev/Search_API#Easy_case:_
Activity_information
Easy case: Add my activity info
9. MOODLEMOOT AUSTRALIA 2016
● Search result template
○ https://github.com/moodle/moodle/blob/master/search/templates
/result.mustache
● Navigation bar search box
○ https://github.com/moodle/moodle/blob/master/lib/outputrender
ers.php#L3279
Extra stuff to customise