About a month ago, I received an e-mail from Packt Publishing asking if I would like to be a technical reviewer for one of their books, “Moodle 2.5 Multimedia”. They had found me through this blog where I’ve covered my projects on Moodle. I was really excited and immediately said yes.
Finally reading the book, I could say it provides a different outlook on presenting courses with multimedia content embedded in Moodle modules and resources. This book would help people in providing their audience with a very rich experience of Moodle courses. As a FOSS lover, I was really happy to see how most examples in the book were based on Open Source applications.
These past days I’ve been busy trying to come up with a working product with the features that I’d earlier planned to include in this version of Global Search.
Finally, I feel happy to complete this milestone. Both my mentors Tomasz and Aparup have guided me well in this project clearing my doubts every now and then. Tomasz has even installed the Global Search plugin on his website. You may try it out here:global-search.jmuras.com
Feel free to clone my Moodle gs2 branch and try out the product. I need deveopers to try it out and test it for any security leaks. The wiki has been updated with the complete procedure for setting up Global Search. Feel free to contact me with your feedback and comments. Continue reading
This week I integrated Apache Tika into Moodle to support indexing of Rich Documents like
.PPT etc. Solr’s ExtractingRequestHandler uses Tika allowing users to upload binary files to Solr and have Solr extract text from it and then index it, making them searchable.
One has to send the file to Solr via
HTTP POST. The following
cURL request does the work:
curl "http://localhost:8983/solr/update/extract?literal.id=1&commit=true" -F "firstname.lastname@example.org"
ps.pdf: file is sent to Solr to extract content from it.
literal.id=1: assigns the
id=1 to the Solr Document thus created.
commit=true: Commits the changes to the solr index.
email@example.com: This needs to be a valid relative or absolute path.
Refer the wiki for more options on
This week I started off starting the Search API functions for Global Search. The idea is to code 3 functions for each module. These will be written in the module’s
The former two functions are used while indexing records while the last one is used to check user permissions for displaying the search results.
The admin has the option to enable a particular module/resource for supporting Global Search through settings. You may view the code here
The first function
_get_iterator($from=0) will return a recordset. I’ve already covered it in Updating Solr Index in Global Search
The second function
_search_get_documents($id) creates a
SolrInputDocument by including data from the database by specifying fields.
An example is shown below:
The tricky part is to correctly structure our indexed records. For example, for the
_get_iterator() will return the record of a particular chapter. Hence, each chapter will be a separate
SolrInputDocument having solr field
The third function maintains security by checking Moodle caps and restricting access to prohibited search results. I’ve already discussed about Global Search security in Handling security in Global Search.
I implemented the functionality of allowing the
admin to delete solr index recently. The code can be seen here.
Solr provides a simple way of deleting indexing using
SolrClient::deleteByQuery. I have provided two types of deleting index:
• Delelting the complete index in one-go.
• Deleteing index modularily. (For example, deleting index for records belonging to
page modules only)
The idea was to make the
admin select the delete option:
All or let the
admin choose the modules. I made these options available to the
admin through Moodle Quick Forms. Continue reading