volto icon indicating copy to clipboard operation
volto copied to clipboard

[Search Block] do not send sorting information by default

Open erral opened this issue 2 years ago • 9 comments

Fixes #5338

erral avatar Oct 25 '23 13:10 erral

Deploy Preview for volto canceled.

Name Link
Latest commit 4eb698abfd31f0a4e6847ddadb142ba91ff25abb
Latest deploy log https://app.netlify.com/sites/volto/deploys/65eeb28e04abf00008873df8

netlify[bot] avatar Oct 25 '23 13:10 netlify[bot]

I have a deja-vu on this one... didn't we have to setup the defaults for the p.a.q. to behave like it's intended? (eg. what show in the default controls). Didn't Plone classic also sets it in the collections by default?

sneridagh avatar Oct 27 '23 10:10 sneridagh

This is a search block which is not feature-paired with a Collection.

When having a full text search you don't want to sort by effective date by default, it goes against the meaning of 'fulltext' which is sorted by relevance.

If you want to set a default sorting criteria you can do it: set it in the configuration of the block, if I don't set anything don't think replacing me.

This happens, and I know it is not a restapi or Volto problem, because we don't have a key in ZCatalog to 'soft by relevance'.

erral avatar Oct 27 '23 12:10 erral

@erral I just dig into it and my concerns are gone now... somehow I remembered that defaults were in there for a reason. Could you please go ahead with David's suggestions? Thanks!

sneridagh avatar Nov 04 '23 08:11 sneridagh

Oh, and this is a change of behavior that could potentially affect existing projects so it must be a breaking change...

sneridagh avatar Nov 04 '23 09:11 sneridagh

Well, I have no problem on adding the behavior that @davisagli suggests, but I think that's wrong. We already have a setting in the search block to let the user select the sorting of the results, if the user hasn't selected anything, I think that we are not entitled to decide which is the correct sorting. If so we would have implemented it in ZCatalog right?

And breaking... well it breaks the current way of working, which is wrong :)

erral avatar Nov 05 '23 17:11 erral

It makes sense to me to remove the default sort_on by effective IF the block has no configured sort AND the user has entered a SearchableText query.

Yes, this should be the default behavior. Relevance based search when there's searchable text, all the time.

tiberiuichim avatar Nov 05 '23 19:11 tiberiuichim

I have updated the PR with the SearchableText query test and rebased it on main

erral avatar Dec 06 '23 18:12 erral

Deploy Preview for plone-components canceled.

Name Link
Latest commit 6e12b6da47a29c630acc5fbcef4643a857d3cb94
Latest deploy log https://app.netlify.com/sites/plone-components/deploys/669cdb920044a90008aecba3

netlify[bot] avatar Dec 23 '23 12:12 netlify[bot]

@davisagli @sneridagh this looks like something that is ready to merge and could make it in 18, are there any further blockers from merging this given that 18 is, either way, a breaking change release?

ichim-david avatar Jul 21 '24 10:07 ichim-david