Future major features

Moodle's Global Search

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Picture of Prateek Sachan
Moodle's Global Search

As part of GSoC '13 project, I've re-written the Global Search for Moodle. The code was written with Moodle_25 as base branch. My plan was to make it part of Moodle core (2.6 onwards). I hope to successfully be able to make it a part of Moodle core.

I would like developers to help integrate it into core.

I've also written a few PHP Unit tests to help developers test Global Search's security w.rt. searchable modules. Please feel free to test it and expand the PHP Unit tests. Following are some useful links: 

Issue Tracker: https://tracker.moodle.org/browse/MDL-31989

Original Branch : https://github.com/prateeksachan/moodle/tree/gs2

Rebased branch (rebased off master Build: 20130920): https://github.com/prateeksachan/moodle/tree/gs2rebased

Global Search docs: http://docs.moodle.org/dev/Global_search

Developer Forum discussion: https://moodle.org/mod/forum/discuss.php?d=227805

My blog posts covering some developments: http://prateeksachan.com/tags/gsoc/


Average of ratings: Useful (1)
Picture of Tomasz Muras
Re: Moodle's Global Search
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Plugins guardiansGroup Translators

Hi MoodleHQ,

Are there any plans to integrate Prateek work on Global Search into Moodle? Is there anything technical that is stopping it?


Average of ratings: -
Picture of Adam Morris
Re: Moodle's Global Search

I got a pretty decent PHP programmer who got us a 'global search' feature in just a few weeks' time. No need to install additional servers or anything like that. It just works now.


Average of ratings: Useful (2)
Re: Moodle's Global Search
Group Particularly helpful Moodlers

Thanks Adam. Looks interesting! I'm installing it right now! approve

Average of ratings: -
Re: Moodle's Global Search
Group Particularly helpful Moodlers

I installed it in on my Windows 7 Ultimate 64 laptop without problems. Great!

Moodle is running under:

  • IIS v7.5
  • SQL Server 2008 R2
  • Microsoft Drivers for PHP for SQL Server v2.0.1082.
  • PHP v5.3
  • $CFG->dbtype = 'sqlsrv';
  • Moodle debug is set to Developer level.

But when I add the block on the front page of my Moodle 2.5.4+ (Build: 20140131) test installation I crash with this error:

PHP Notice: Undefined offset: 1 in C:\Moodle\App v2.5.4
20140131\moodle\blocks\search\MoodleSearch\Model\Search.php on line 477 PHP
Stack trace: PHP 1. {main}() C:\Moodle\App v2.5.4
20140131\moodle\blocks\search\index.php:0 PHP 2. MoodleSearch\Block->search()
C:\Moodle\App v2.5.4 20140131\moodle\blocks\search\index.php:87 PHP 3.
MoodleSearch\Search->__construct() C:\Moodle\App v2.5.4
20140131\moodle\blocks\search\MoodleSearch\Block.php:86 PHP 4.
MoodleSearch\Search->runSearch() C:\Moodle\App v2.5.4
20140131\moodle\blocks\search\MoodleSearch\Model\Search.php:47 PHP 5.
MoodleSearch\Search->searchTable() C:\Moodle\App v2.5.4
20140131\moodle\blocks\search\MoodleSearch\Model\Search.php:193 PHP 6.
MoodleSearch\Search->buildWordQuery() C:\Moodle\App v2.5.4
20140131\moodle\blocks\search\MoodleSearch\Model\Search.php:225 PHP 7.
MoodleSearch\Search->getTextSubstitutions() C:\Moodle\App v2.5.4
20140131\moodle\blocks\search\MoodleSearch\Model\Search.php:378 Default
exception handler: Error reading from database Debug: SQLState: 42000
Code: 8116
Message: [Microsoft][SQL Server Native Client 10.0][SQL
Server]Argument data type ntext is invalid for argument 1 of lower
SELECT * FROM mdl_assign WHERE (((LOWER(name) LIKE N'%humpty%') AND
(LOWER(name) LIKE N'%dumpty%')) OR ((LOWER(intro) LIKE N'%humpty%') AND
(LOWER(intro) LIKE N'%dumpty%'))) AND course = '1' [array ( 0 => '%humpty%',
1 => '%dumpty%', 2 => '%humpty%', 3 => '%dumpty%', 4 => 1, )] Error
code: dmlreadexception * line 423 of \lib\dml\moodle_database.php:
dml_read_exception thrown * line 260 of
\lib\dml\sqlsrv_native_moodle_database.php: call to
moodle_database->query_end() * line 367 of
\lib\dml\sqlsrv_native_moodle_database.php: call to
sqlsrv_native_moodle_database->query_end() * line 788 of
\lib\dml\sqlsrv_native_moodle_database.php: call to
sqlsrv_native_moodle_database->do_query() * line 836 of
\lib\dml\sqlsrv_native_moodle_database.php: call to
sqlsrv_native_moodle_database->get_recordset_sql() * line 239 of
\blocks\search\MoodleSearch\Model\Search.php: call to
sqlsrv_native_moodle_database->get_records_sql() * line 193 of
\blocks\search\MoodleSearch\Model\Search.php: call to
MoodleSearch\Search->searchTable() * line 47 of
\blocks\search\MoodleSearch\Model\Search.php: call to
MoodleSearch\Search->runSearch() * line 86 of
\blocks\search\MoodleSearch\Block.php: call to
MoodleSearch\Search->__construct() * line 87 of \blocks\search\index.php:
call to MoodleSearch\Block->search()

This might be the 'ntext monster' coming back to haunt me again (MDL-11270).

Average of ratings: -