- Issue created by @Marios Anagnostopoulos
- Merge request !263Make TermWeightWidgetOrderProcessor respect the full hierarchy. → (Open) created by Marios Anagnostopoulos
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.
Active
3.0
Code