Full text search
  • 05 Jul 2023
  • 2 minutes to read

Full text search


Article Summary

Full text search (FTS) allows a sophisticated approach to text search in Totara, particularly within the catalogue.

Instead of plain substring search, it leverages FTS features provided by database systems to improve search results in the following ways:

  • Order by relevance
  • Search of phrases even when words are ordered differently
  • Language-aware search
  • Word forms and time-aware search (be/was/is or run/ran)
  • Diacritics support
  • Morphological search
  • Partial search from beginning of the words (e.g. 'Edu*' will return items with word 'Education')

All these advantages can significantly improve the user search experience, helping to find the most relevant content for them.

Totara does not perform full text search by itself, but leverages capabilities provided by database engines. This means that the existence and performance of any of these features depends solely on the database engine used, and how it is configured.

Database FTS greatly reduces the need in infrastructure overhead requirements for third party FTS solutions like Elasticsearch. However, in some cases it also requires additional configuration of used databases to enable certain search features. Otherwise, only basic FTS features will be available. Currently only a single language per site is supported within full text search. 

Language support

Unlike other existing data definition language (DDL) features, full text search is language aware. The language is specified during the creation of the index, and is used by your database in the production of the index. It is used for the likes of breaking words, ignoring noise words (a, it, and etc.), and for other linguistic features provided by the full text search index of your database.

Totara full text search supports one language only. It should be specified in your config.php file, and we recommend setting it to a language compatible with your $CFG→lang. The actual value is database independent.

To set your language add the following to your config.php:

$CFG->dboptions['ftslanguage'] = 'your language';

The actual value is database dependent.

With FTS, it is possible to search for partial words. To do this, just put an asterisk (*) after the beginning of the word in the search input. For example, searching for 'edu*' will return items that contain the word 'education' in them).

All supported databases work with this feature and no additional configuration is required. If a particular database requires another wildcard character then Totara will handle that for the user.

Generally, having proper vocabularies in database word stemming will provide both accented and unaccented versions of word stem. However, if your database configuration doesn't allow that then accents can be disabled globally by adjusting configuration variable:

$CFG→dboptions['ftsaccentsensitivity'] = false;

And running FTS re-populating tables:

php admin/cli/fts_rebuild_indexes.php

Database-specific information

To get the most out of full text search, database administrators need to follow their database documentation to enable and configure relevant database plugins, install dictionaries, and adjust various database settings.

In addition, we have collected and provided some tips and tricks for the following databases. This is not a replacement for official database documentation, but rather a selection of examples showing how various settings can affect search results. 

Next steps

© Copyright 2024 Totara Learning Solutions. All rights reserved. Some content originally obtained via GPLv3 license and continues to be available under GPLv3. All other content is the sole copyright of Totara Learning Solutions. 


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.