Global search: Solr searchquery without wildcards

Global search: Solr searchquery without wildcards

by Adrian Perez Rodriguez -
Number of replies: 2

Hi all

We've figured out on https://demo.moodle.net, that the "Simple search", using a query "course", will list all courses containing this word, e.g.:

  • My first course
  • My second course
  • My second course2

On our Moodle platforms we're using the "Solr" and here it works only when the query will be "course*". How can we get rid of this wildcard character, and let Solr understand that we always want to have all search results with "course".

This is mandatory as Moodle >=3.8  will use the global search, if it's configured (see https://github.com/moodle/moodle/commit/36667548b5c6e8f8b1b401ad7cbc2076fe328cb0), in the /course/search.php input field.

And now when a user searches courses as before, he must be very specific to search the courses.

Thanks for your help,
Adrian

Average of ratings: -
In reply to Adrian Perez Rodriguez

Re: Global search: Solr searchquery without wildcards

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Adrian,

Here on moodle.org, Solr is the search engine, and course search works fine without a wildcard character. Sorry I don't know why it is needed on your sites.

In reply to Helen Foster

Re: Global search: Solr searchquery without wildcards

by Adrian Perez Rodriguez -

Thanks for your response.

Did it work well for course title, summary or contents?

In our case we have courses named in full- and shortname with these patterns:

  • ACF1
  • ACF8
  • ACF11

When we search now with Solr, the user must type in "acf*" to get all three courses. When the user searches for "acf", the results list will be empty. With the "old normal" course search the user can type in "acf" to get all these courses. Or to be more specific he can type in acf1 and gets:

  • ACF1
  • ACF11

But with Solr you must type in "acf1*" in this case.

I don't think that Solr is misconfigured, as I've done a clean setup locally and it behaves was on our productive one.

HTH, Adrian