Facet term weight order processor should respect taxonomy hierarchy

Created on 10 December 2024, 5 months ago

Using the TermWeightWidgetOrderProcessor, terms are sorted based on their weight attribute, but when using hierarchy, each nesting level starts from 0. As a result

The tree

- Term1
- Term1.1
- Term1.2
-Term1.1.1
- Term2
- Term3
- Term3.1

Will be sorted like so

Term1, Term1.1, Term1.1.1, Term3.1, Term1.2, Term2, Term1.2. Which is not what someone (at least I) would expect.
A more expected behavior IMHO would be for them to be sorted in their flattened hierarchy representation.

Proposed resolution:
Utilize the Alphadecimal representation of each terms ancestors (and own) weights. (i.e. use 0.1.0 for Term1.1.1 or 2.0 for Term3.1

Initially this can be done inside the TermWeightWidgetOrderProcessor, since TermstorageInterface::loadAllParents utilizes static caching already, and if deemed necessary, as a next step, we could try providing a way to index it as well.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024