Bug 14371

Summary: Facets should be sorted by label (displayed) not title (link value)
Product: Koha Reporter: Nick Clemens <nick>
Component: SearchingAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: chris, jonathan.druart, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 14371 - Facets should be sorted by label (displayed) not title (link value)
[SIGNED-OFF] Bug 14371 - Facets should be sorted by label (displayed) not title (link value)
Bug 14371 - Facets should be sorted by label (displayed) not title (link value)
[SIGNED-OFF] Bug 14371 - Facets should be sorted by label (displayed) not title (link value)
Bug 14371 - Facets should be sorted by label (displayed) not title (link value)

Description Nick Clemens 2015-06-10 01:50:05 UTC
For facets like Branches, Item Types, and Locations if the code/display differ in alphabetical sort values you get results that are out of order to the user.

To reproduce:
Pick two libraries e.g. Centerville(CPL) and Fairfield (FFL)
Perform a search with results in each branch and see that Branch facets appear correctly sorted
Rename Centerville as Zebra and Fairfield as Aardvark
Repeat search and see that Branch facets are incorrectly sorted
Comment 1 Nick Clemens 2015-06-10 02:00:16 UTC Comment hidden (obsolete)
Comment 2 Bernardo Gonzalez Kriegel 2015-06-18 15:06:37 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2015-06-18 15:52:50 UTC
This change should also done at the OPAC.
Comment 4 Jonathan Druart 2015-06-18 15:53:08 UTC
*be*
Comment 5 Nick Clemens 2015-06-18 17:22:40 UTC Comment hidden (obsolete)
Comment 6 Bernardo Gonzalez Kriegel 2015-06-19 14:21:28 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2015-06-19 14:34:07 UTC
Created attachment 40382 [details] [review]
Bug 14371 - Facets should be sorted by label (displayed) not title (link value)

This patch changes one small line in catalogue/search.pl and opac/opac-search to sort facets by:
facet_label_value
instead of
facet_title_value

To test:
1 - Perform a search with results in two branches e.g. Centerville (code CPL) and Fairfield (code FPL)
2 - Notice that branch facets appear correctly sorted
3 - Rename the branches Centervile->Zebra and Fairfeild->Aardvark (but don't change codes)
4 - Repeat original search
5 - Note that branch facets are no longer correctly sorted
6 - Apply patch
7 - Repeat search
8 - Facets should be correctly sorted
9 - Test in both staff and opac search
10 - Ensure there are no unintended consequences/regressions

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described,  staff AND opac
No errors

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Comment 8 Tomás Cohen Arazi 2015-06-22 14:55:40 UTC
Patch pushed to master.

Thanks Nick!
Comment 9 Chris Cormack 2015-07-09 21:09:36 UTC
Pushed to 3.20.x will be in 3.20.2