Sort-by functionality broken

Sort-by functionality broken

by Matthew Mazurek -
Number of replies: 3

When searching a database using the simple search form, the default search functionality with the "sort-by" parameter seems to be broken.

When the "sort-by" parameter is set to one of the "Other" values, eg. "Time added", the search functions as expected. Ie., The search term is used to query the database over all fields and then the results are sorted by "time added". However, if the "sort-by" parameter is set to one of the "Fields", the search query breaks down. Only the "sort-by" field is queried for the search term and the results are then sorted by the "sort-by" field.

In the example below, you would expect that searching for "Swedish" and sorting by recipe type would display all recipes matching "Swedish", including "Swedish delight", and sorting the results by type ("vegetarian", "meat", etc.). However, because "Swedish" isn't a type, no results are returned.

Demo : http://school.demo.moodle.net/mod/data/view.php?d=21

Is there a way to change this search behaviour to a more intuitive one?

Average of ratings: -
In reply to Matthew Mazurek

Re: Sort-by functionality broken

by William Lu -
Picture of Particularly helpful Moodlers

Hi Matthew,

I tested: 'Search any text' works and can be sorted by most fields.

For example: 'wine' + 'sort by date' below:


But the combination of 'Text Search' and sort by 'Radio button' field not working.

It is a bug!!!

Would you please submit to bug report? http://moodle.org/bugs/

Thanks


In reply to Matthew Mazurek

Re: Sort-by functionality broken

by William Lu -
Picture of Particularly helpful Moodlers

Tested again:

In the 'Basic search form' under the "View List' page, 

'Search text' + Sort by 'Fields' ----- not working . 

'Search text' + Sort by 'Other Fields' ----- Working properly . 

Please test with the attached preset and see the screenshot below:


If we tick the 'Advanced search' checkbox, or use the 'Search tab', then all search combination will work as we expected.

So, I think it is a small bug and won't bother me very much. But it will be good if the database can be perfect smile

In reply to William Lu

Re: Sort-by functionality broken

by Matthew Mazurek -
Yes, the problem remains though that if default sorting is turned on to one

of the custom fields, the default user search will not work. The user must

change the sort behavior before searching, or know to use the advanced