Default 'Relevance' sort order missing from search block's `Sort on options`
See original GitHub issueDescribe the bug
If a sort_on
key is not specified, Plone will order a querystring search by ‘relevance’, which is often the desired behaviour. A search block enables site viewer sorting options and will default to the relevance
sorting if one is not selected. Not only is it not possible to return to the relevance
sorting once an option has been set, it isn’t clear that Plone is even performing a relevance
sort initially as it isn’t mentioned anywhere. It would nice for site editors to be able to add a Relevance
option to the search block’s sort on options.
To Reproduce Steps to reproduce the behavior:
- Create a search block
- Enable the
Show sorting
option in theControls
fieldset - Try to add an option to allow sorting by
relevance
Expected behavior
An option for relevance
is shown in the dropdown. This option would simply remove the sort_on
key from the querystring, allowing Plone to return to it’s default sort order.
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (7 by maintainers)
I think having “Relevance” as an option would be just fine.
Just working on this now and realistically the behaviour is already there, it’s just that the ‘No selection’ option in the sort on needs renaming and for it to be selectable. My first attempt at this (shown below) checked whether there was any text in the search box and changed the label between ‘Relevance’ and ‘Unsorted’, but this doesn’t feel quite right that the relevance option seems to disappear. Does it maybe make sense to always show ‘Relevance’ if the search input is visible, but if it’s hidden (i.e. filter only search block) then change the text to ‘Unsorted’?
https://user-images.githubusercontent.com/30210785/206512157-39f68cf3-56cd-422e-8769-f28a5dc723c5.mov