Moodle LMS Integration Tutorial
Moodle + Opensolr
Moodle's built-in search is limited — it only looks through activity names and descriptions. By connecting Moodle to Opensolr via the Global Search feature, students and teachers can instantly search across courses, forums, assignments, wikis, glossaries, uploaded files (PDFs, DOCs), and more.
Prerequisites
- Moodle 3.1 or later (Global Search requires Moodle 3.1+)
- An Opensolr Index (create one at opensolr.com)
- Solr PHP PECL extension is NOT required when using Opensolr — Moodle connects via HTTP
Setup Steps
Step 1: Upload the Moodle Schema
Moodle needs a specific schema.xml to work with Solr. You can get it from Moodle's setup page or use the one bundled with Moodle at search/engine/solr/.
- Go to your Opensolr Index Control Panel
- Open the Config Files Editor
- Upload the Moodle
schema.xml - Click Reload to apply the schema
Alternatively, in Moodle 3.5+, the schema can be created automatically from the admin page.
Step 2: Enable Global Search in Moodle
- Go to Site Administration > Advanced Features
- Check Enable Global Search
- Click Save changes
Step 3: Select Solr as the Search Engine
- Go to Site Administration > Plugins > Search > Manage Global Search
- Set the Search engine to Solr
- Click Save changes
Step 4: Configure the Solr Connection
Go to Site Administration > Plugins > Search > Solr and enter your Opensolr connection details:
| Setting | Value |
|---|---|
| Host name | Your Opensolr hostname (e.g., useast94.solrcluster.com) |
| Port | 443 |
| Secure | Yes (check the SSL box) |
| Index name | Your core name from Opensolr |
| Username | Your Opensolr username |
| Password | Your Opensolr password |
Click Save changes, then click Test connection to verify.
Step 5: Index Your Moodle Content
You can index from the web interface or via CLI (recommended for large sites):
Via Moodle Admin UI: Go to Site Administration > Reports > Global Search Info and click Index.
Via CLI (recommended):
php search/cli/indexer.php --force
For ongoing indexing, add a cron job:
*/5 * * * * php /path/to/moodle/search/cli/indexer.php
Enabling File Search
Solr can index the contents of uploaded files (PDFs, Word documents, etc.) using the built-in Tika engine:
- Go to Site Administration > Plugins > Search > Solr
- Enable Enable file indexing
- Re-index your content
Now students can search inside PDF handouts, uploaded lecture notes, and document attachments.
Access Control
Moodle handles access control automatically. When a student searches, they only see results from courses they are enrolled in. Teachers see content from courses they teach. Admins see everything. The search engine returns all matches, and Moodle filters based on permissions.
Quick Checklist
- Upload the Moodle schema.xml to your Opensolr Index
- Enable Global Search in Moodle's advanced features
- Set the search engine to Solr in the plugin settings
- Configure the Opensolr connection (host, port 443, SSL, credentials)
- Run the indexer to populate the search index
- Optionally enable file indexing for PDF/DOC content search
- Set up a cron job for ongoing indexing
Need help connecting Moodle to Opensolr? Reach out to us at support@opensolr.com — we will walk you through the setup.