Moodle v3.9 Global Search Error

Moodle v3.9 Global Search Error

by Megan Thoresson -
Number of replies: 10

Hi, I have enabled the global search in Moodle.  Now when I try to search it is coming up with the message : Error reading from database

Our organisation does not have a Moodle developer/technologist - I have admin rights, to do the basics - so am not an expert.


If you can help I will be grateful.  Our Moodle is hosted on a server called Rackspace.

Many thanks, Megan

Average of ratings: -
In reply to Megan Thoresson

Re: Moodle v3.9 Global Search Error

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Enable debugging as shown here. This should provide more details when the error appears.

In reply to Leon Stringer

Re: Moodle v3.9 Global Search Error

by Megan Thoresson -

Thank you Leon, I have followed your instructions to enable debugging, but the message remains the same.🤔

In reply to Megan Thoresson

Re: Moodle v3.9 Global Search Error

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Can you share a screenshot of the error? Hide or remove any information you don't want to share on the Internet.

If it's not shown the screenshot, can you tell us the web address you're on when the error occurs . You don't have to include the domain name just the part afterwards, for example: …/search/index.php?context=1&q=interesting+course

Do you have access to the web server error logs? Do these contain any relevant messages?

Please can you tell us the full Moodle version and build number shown under Site administrationNotifications, for example: Moodle 3.9.4+ (Build: 20210204).

And can you share a screenshot of the Global Search settings page on admin/settings.php?section=manageglobalsearch, for example:

Screenshot of the top of the Manage Global Search page

In reply to Leon Stringer

Re: Moodle v3.9 Global Search Error

by Megan Thoresson -

Hi Leon as below.  The 'More information about this error' goes to the debugging instructions which I have followed and enabled.


Many thanks, Megan




In reply to Megan Thoresson

Re: Moodle v3.9 Global Search Error

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

And Display debug messages is definitely Yes?:

Display debug messages (debugdisplay): Yes

I can only see one "Error reading from database" message in Moodle 3.9 and it should always have additional details available.

In reply to Leon Stringer

Re: Moodle v3.9 Global Search Error

by Megan Thoresson -

My bad! 😳 Debugging now properly enabled! 


In reply to Megan Thoresson

Re: Moodle v3.9 Global Search Error

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

There's an index missing from the Moodle database. If you know how to run database statements this can probably be fixed with:

CREATE FULLTEXT INDEX mdl_search_simpledb_index_index
  ON mdl_search_simpledb_index (title, content, description1, description2);

For example in phpMyAdmin:

Screenshot of CREATE FULLTEXT INDEX statement in phpMyAdmin

Depending on the size of the site this may take some time to complete and may impact Moodle's performance while it's running.

The missing index is needed for Simple Search which was added in Moodle 3.5. If it didn't get created then I would expect that the install or upgrade to 3.5 or higher would have had an error at the time.

In reply to Leon Stringer

Re: Moodle v3.9 Global Search Error

by Megan Thoresson -

Hi Leon - Search set up looks like this:  I notice it says Apache Solr PHP extension is not installed.  I won't have the documentation (I don't think) but could ask our server host? Thank you. Megan


In reply to Megan Thoresson

Re: Moodle v3.9 Global Search Error

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

In Select search engine shown in your screenshot you can select which search engine to use. Moodle supports two by default: Simple Search and Solr.

Simple Search uses the existing Moodle database, you don't need anything else. Solr is extra software that you need to set up, sometimes it's installed on a dedicated server. Solr is better than Simple Search – faster, more precise criteria – but it needs to be set up and maintained in addition to Moodle. Details are available in the docs.

In reply to Leon Stringer

Re: Moodle v3.9 Global Search Error

by Megan Thoresson -

Hi thanks so much for your two previous posts.  I have passed on to the people who host our server and understand the coding better than me  - hopefully will get a fix for this.  Much appreciated. Megan