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

@ -71,6 +71,9 @@ if ($contextid) {
}
$customdata['searchwithin'] = $searchwithin;
}
// Get available ordering options from search engine.
$customdata['orderoptions'] = $search->get_engine()->get_supported_orders($context);
}
$mform = new \core_search\output\form\search(null, $customdata);
@ -112,6 +115,11 @@ if ($data && !empty($data->searchwithin)) {
}
}
// Inform search engine about source context.
if (!empty($context) && $data) {
$data->context = $context;
}
// Set the page URL.
$urlparams = array('page' => $page);
if ($data) {