Bug 14417

Summary: Facet labels sorted incorrectly (OPAC) and inconsistently (OPAC vs Staff)
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: SearchingAssignee: Galen Charlton <gmcharlt>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: magnus
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25701
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Nick Clemens (kidclamp) 2015-06-18 19:52:27 UTC
While working on Bug 14371 I noticed the line in opac-search.pl:
@$facets = sort {$a->{expand} cmp $b->{expand}} @$facets;

This seems to be intended to sort facets so that labels display in order in search results, however, it doesn't work. 

'expand' contains the facet index code (su-geo, itype, au, se ...) instead of the label value (Places, Item Types, Author, Series) so sorting doesn't work out ('Places' sorts after 'Series')

The actual labels are assigned by and IF statement in opac-facets.inc and are translatable so I think any sorting would have to be done post page creation (javascript?)

No sorting of any kind is applied in catalog/search.pl, so facet results between staff/opac don't match up.
Comment 1 Magnus Enger 2020-12-07 12:02:52 UTC
Is this fixed by bug 25701, or is the scope different?
Comment 2 Nick Clemens (kidclamp) 2020-12-07 12:53:30 UTC
(In reply to Magnus Enger from comment #1)
> Is this fixed by bug 25701, or is the scope different?

I believe this is resolved