fix: #3620443 Sort by the number of shared terms, not joined rows

Sort by the count of the shared terms (similarterms_taxonomy_index.tid) instead of the joined rows, as the field handler does. The argument joins the terms with a LEFT JOIN, so an item without shared terms has one row with an empty term and ranked equal to an item with one shared term.

The new kernel test testSortRanksOneMatchAboveNone covers both sort orders; it fails without the change.

Closes #3620443

Merge request reports

Loading
Loading