MDL-59434 core_search: Alternate result orders including by context

Implements a mechanism by which search engines can provide different
result orderings, and implements a 'by location' ordering within the
Solr search engine (available whenever the user starts their search
from within a course or activity).
This commit is contained in:
sam marshall 2017-11-23 10:55:07 +00:00
parent b63a3b04b1
commit fc440796e9
9 changed files with 211 additions and 0 deletions

View file

@ -55,6 +55,15 @@ class search extends \moodleform {
$mform->setDefault('searchwithin', '');
}
// If the search engine provides multiple ways to order results, show options.
if (!empty($this->_customdata['orderoptions']) &&
count($this->_customdata['orderoptions']) > 1) {
$mform->addElement('select', 'order', get_string('order', 'search'),
$this->_customdata['orderoptions']);
$mform->setDefault('order', 'relevance');
}
$mform->addElement('header', 'filtersection', get_string('filterheader', 'search'));
$mform->setExpanded('filtersection', false);