question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default 'Relevance' sort order missing from search block's `Sort on options`

See original GitHub issue

Describe 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:

  1. Create a search block
  2. Enable the Show sorting option in the Controls fieldset
  3. 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:open
  • Created 10 months ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tiberiuichimcommented, Nov 28, 2022

I think having “Relevance” as an option would be just fine.

0reactions
JeffersonBledsoecommented, Dec 8, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sort search results | Elasticsearch Guide [8.5] | Elastic
Sort search resultsedit ... The order option can have the following values: ... The default sort mode in the ascending sort order is...
Read more >
Exposed sorts, that also exist as a default sort for a view, never ...
I have a view with exposed sorts: - Relevance - Date ascending - Date descending - Title ascending - Title descending And default...
Read more >
magento 1.9 - Remove option "Relevance" from sort by
To remove relevance sort order in searching you can rewrite below class. app/code/core/Mage/CatalogSearch/Block/Result.php.
Read more >
Relevant sorting - Algolia
Use relevant sorting to only show the most relevant results for a user's search instead of displaying all the records (exhaustive sorting).
Read more >
How to troubleshoot Sort by options issues - Boost Commerce
This is the guide to fix some common Sort by options issues. ... About the Search page, its default sorting is Relevant order....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found