[3.9] How does the new search work?

[3.9] How does the new search work?

by Richard van Iwaarden -
Number of replies: 1
Picture of Particularly helpful Moodlers

We just upgraded from 3.7 to 3.9 and now I find that I can't search for just the course title.

We had two search options in Moodle 3.7. We could search inside courses (global search) or we could search just for course names (the course title)

I had two links for this:

yourmoodle/search for global search AND

yourmoodle/course/search.php for course search.

After the update, the moodle-course search redirects to the global search. This seems to makes searching for courses a lot more difficult and the search results are way more extensive.

Any ideas on how to create a direct link that just searches for course names?


Average of ratings: -
In reply to Richard van Iwaarden

Re: [3.9] How does the new search work?

by Jeff Noel -
Hi Richard,

You might be interested in my last reply on my 3.8+ search latency issue here: moodle.org/mod/forum/discuss.php?d=408080#p1648778

To sum it up, you can change the form "action" attribute in /course/search.php to target "/course/search.php" insead of "search/index.php".
I did this through a Javascript script in /admin/settings.php?section=additionalhtml by adding the code in the footer part (make sure jQuery is working beforehand and put the code in between script tags):

$(document).ready(function(){
if (window.location.toString().indexOf('/course/search.php') != -1){
    $('form[action="https://yourmoodleinstance.com/search/index.php"]').prop('action','https://yourmoodleinstance.com/course/search.php');
    }
});
Make sure to replace the domain name in the URL.
Average of ratings: Useful (2)