The catalogue can be sorted and displayed in variety of ways:
- In Alphabetical order
- By the most recently added items (Latest)
- With Featured Learning items listed first (where Featured Learning has been enabled)
- By Relevance (available after a text search term has been entered)
Sorting when multiple language are enabled
When multiple languages are installed, the sorting dropdown in the catalogue is removed. Instead, sorting is automatically managed, depending on the status of the catalogue. In order of precedence (highest first):
- If the text search is active then sorting is by relevance
- If Featured learning is configured then featured items will be sorted first, and the secondary sorting is by latest first (the latest featured item will appear first in the results, and the latest non-featured item will appear just after all the featured items)
- Otherwise, sorting is by latest first
The dropdown/alphabetical sorting box can be re-enabled by setting the catalog_enable_alpha_sorting_with_multiple_languages config variable - see config-dist.php for details. Using this option makes sense for sites that predominantly use just one language, or sites that use multiple languages but define separate learning items for each language (e.g. one course for German users, another course for French users) and don't use the "Multi-language Content" filter or a similar filter which can modify the data that users see. Sites that use both EN(US) and EN(GB) (or some similar combination of languages which have a high degree of commonality between them) should enable this setting.
Technical reasoning behind lack of sorting
The reasoning behind this behaviour is that sorting alphabetically with multiple languages doesn't work. We need to do sorting on the database, but applying language filters etc can only be done at the php side. So at best, it would be sorted correctly for all users of the 'primary' language, but would appear in random order for users viewing the data in another language.
This problem is compounded because other string filter plugins can be used to modify strings, such as a filter to remove obscenities, filters that change a string based on the capabilities of the viewer, or custom filters that clients may have written or be using. In these cases, even sorting alphabetically with just one language may not be accurate. As an example, consider the following course names:
- course 4
- foreign course 3
- learner course x admin course 2
- stupid course 1
which are technically in order, but after filters are applied to translate the 'foreign' in the second course, select the 'admin' course name from the third course, and remove 'stupid' from the fourth course, then the results presented to the user would be:
- course 4
- course 3
- course 2
- course 1
which is very wrong sorting. We decided to leave alphabetical sorting for single-language sites despite these problems. We're hoping people won't be using obscenities in their course titles, and although it's possible that other filters could be modifying the string, we think it's unlikely that that is happening much.
In the future we might implement better solutions to the multiple-language problem. In this case, we might index each language separately, which would then allow sorting using the language of the viewer. This would require a non-trivial change to the data structure of the catalogue, and may not be feasible without first making changes to the way learning items record text (e.g. course title) with multiple languages.