mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
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:
parent
b63a3b04b1
commit
fc440796e9
9 changed files with 211 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue