Weekly Report 10 Gsoc @ Moodle

week 10 (17 august- 24 august)

Task 1 (Implementing auto-complete with solr):-

Solr have out of box capability to autocomplete for fields configured in schema. there are many ways to implement the same. there are-

Autocomplete with advance course search

Autocomplete with advance course search

using term component only single term suggestions are possible, and unfortunately we can’t apply any filter. Furthermore, user queries will not be analyzed in any way; you’ll have access to raw indexed data, so won’t be suggest with whitespaces or case-sensitive queries.

so I found SpellCheckComponent as a best solution. This solution has its own separate index which you can automatically build on every commit.

Configuring SpellCheckComponent handler :-

<requestHandler name="/suggest">
    <lst name="defaults">
      <str name="spellcheck">true</str>
      <str name="spellcheck.dictionary">suggest</str>
      <str name="spellcheck.onlyMorePopular">true</str>
      <str name="spellcheck.count">5</str>
      <str name="spellcheck.collate">true</str>
    <arr name="components">

Schema.xml :-

<fieldtype name="phrase_suggest" class="solr.TextField">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.PatternReplaceFilterFactory"
replacement=" " replace="all"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.TrimFilterFactory"/>

Demo@ Advance course search

Hey everyone,

This week I was doing some minor modification along with creating git wiki, general user documentation etc.

I came up with a short video that shows a live demo how course search gives you better way to search through courses. It proves more handy when you have thousand of courses. we are still working on UI. so its proves more Cool 🙂


Weekly Report 9 Gsoc @ Moodle

week 9 (01 august- 07 august)

Before writing about this weeks task & outcomes. I want to thanks my mentors for their positive feedback and evaluation towards my project. This week I corrected  somes issues including some bugs too.

Task 1 :- Performing plugin checks:-      We need to perform to checks for plugin & behave according to the outcome.

A. Whether the plugin is able to communicate with solr :-  We ping solr if return true solr is reachable if not than we throw the error code.

try {
if (!$this->solr->ping()) {
$this->errorcode = -1;
$this->errormessage = “Ping failed !”;
return false;
} catch (Exception $e)  {



B. Whether Admin tool is installed :-    Just retrieve the installed plugin list if the plugin “Course search” exist we can proceed else throw the errorcode.

$errorcode = 1;


Task 2 Listen to events and mark courses for re-indexing :- We need to re-index or delete a particular course from index if-

— a course is deleted.

— a course is updated

— a course is created

moodle event API  makes this  easy . Although moodle developers are going to rebuild the Event API for moodle 2.6

We just need to create events.php class inside db directory. While the plugin upgrade the the function & corresponding files or trigger are called.

I will be writing some more specification about this task 🙂

Code snippets :-

$handlers = array (
‘course_created’ => array (
‘handlerfile’ => ‘/admin/tool/coursesearch/locallib.php’,
‘handlerfunction’ => ‘deleteById’,
‘schedule’ => ‘instant’,
‘internal’ => 1,


Thanks 🙂

Weekly Report 8 Gsoc @ Moodle

week 8(20 july- 28 july )

Task 1 :- Search into compressed archives –  unfortunately Solr doesn’t search into compressed file contents only index the file names. But its important for the courses attachments to search into compressed archives like zip, rar, gz, tar.gz etc.

After a long search and discussion over #solr  I came to know about a jira issue. that was reported by jayendra. I want to thanks him. this jira issue along with patch made the things work.

Link to issue :- SOLR-2416

following are the complete steps to make it work :-

1. By using the latest solr trunk apply the following patch found in the jira issue.

2. Now rebuild  the solr.

3.  Replace the solr-cell jar with your one.

and its all now you can search into archives content too.

Task 2 :- Checking the code with Code checker – Everything excluding the solr-php-client library must follow the moodle coding style hence I ran code checker & removed all warning & errors. (https://moodle.org/plugins/view.php?plugin=local_codechecker)

Task 3 :- Testing everything works fine & submitting the source.

Task 4 :-  last and most important submitting the mid term evaluation.

What’s Next week :-

1. Perform the checks on plugin, cleantheme.

  •  Admin tool installed or not ?
  • Solr instance is running or not and properly configured ?

2. Studying the moodle event API.

3. Triggering the events to re-index particular course if :-

  • It is updated
  • Deleted (remove from index)
  • Or any new course is added.

4. Clean the code and push to github.