Bug 24219 - Elasticsearch needs to remember sort preference when returning to result list
Summary: Elasticsearch needs to remember sort preference when returning to result list
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-11 18:57 UTC by Myka Kennedy Stephens
Modified: 2020-11-30 21:48 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00
Circulation function:


Attachments
Bug 24219: Preserve sort order when returning to result list (5.29 KB, patch)
2019-12-17 09:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24219: Preserve sort order when returning to result list (5.35 KB, patch)
2019-12-17 18:11 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 24219: Preserve sort order when returning to result list (6.05 KB, patch)
2020-02-24 12:54 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24219: Preserve sort order when returning to result list (6.10 KB, patch)
2020-03-01 22:54 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 24219: Preserve sort order when returning to result list (6.15 KB, patch)
2020-03-06 11:56 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Myka Kennedy Stephens 2019-12-11 18:57:22 UTC
At the present, the sort preference applied to a list of results in the staff client is not remembered when the user returns to the result list after viewing a record. Ideally, clicking on the button to return to the result list should remember the sort preference selected prior to viewing a record.

Steps to replicate:
1. Have Elasticsearch enabled
2. Perform a search in the staff client
3. Change the sort order to something different (try Author A-Z)
4. Click on a result to view the record
5. Click on "Results" button on left side to return to result list
6. Note that the result list is sorted by relevancy again and not call number

Note: On master, the OPAC remembers sort order in both the "browse results" and "back to results" link.
Comment 1 Jonathan Druart 2019-12-17 09:46:29 UTC
This impacts both Zebra and Elasticsearch
Comment 2 Jonathan Druart 2019-12-17 09:49:58 UTC
Created attachment 96359 [details] [review]
Bug 24219: Preserve sort order when returning to result list

There is a mismatch between sort_cgi, sort and sort_by variables.

 * sort_cgi
I did not find relevant occurrences of sort_cgi in the git log of both
search.pl and results.tt. So it seems that it never worked correctly.
 * sort
It is the JS variable use in browser.js
 * sort_by is the search.pl parameter to set the sort_by option

Test plan:
1. Perform a search in the staff client
2. Change the sort order to something different (try Author A-Z)
3. Click on a result to view the record
4. Click on "Results" button on left side to return to result list
=> Without this patch the result list is sorted by relevancy
=> With this patch applied the Author A-Z is kept
Comment 3 Lucas Gass (lukeg) 2019-12-17 18:11:48 UTC
Created attachment 96390 [details] [review]
Bug 24219: Preserve sort order when returning to result list

There is a mismatch between sort_cgi, sort and sort_by variables.

 * sort_cgi
I did not find relevant occurrences of sort_cgi in the git log of both
search.pl and results.tt. So it seems that it never worked correctly.
 * sort
It is the JS variable use in browser.js
 * sort_by is the search.pl parameter to set the sort_by option

Test plan:
1. Perform a search in the staff client
2. Change the sort order to something different (try Author A-Z)
3. Click on a result to view the record
4. Click on "Results" button on left side to return to result list
=> Without this patch the result list is sorted by relevancy
=> With this patch applied the Author A-Z is kept

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 4 Martin Renvoize (ashimema) 2020-02-24 12:24:45 UTC
Sorry Jonathan, this one needs a rebase.
Comment 5 Jonathan Druart 2020-02-24 12:54:01 UTC
Created attachment 99512 [details] [review]
Bug 24219: Preserve sort order when returning to result list

There is a mismatch between sort_cgi, sort and sort_by variables.

 * sort_cgi
I did not find relevant occurrences of sort_cgi in the git log of both
search.pl and results.tt. So it seems that it never worked correctly.
 * sort
It is the JS variable use in browser.js
 * sort_by is the search.pl parameter to set the sort_by option

Test plan:
1. Perform a search in the staff client
2. Change the sort order to something different (try Author A-Z)
3. Click on a result to view the record
4. Click on "Results" button on left side to return to result list
=> Without this patch the result list is sorted by relevancy
=> With this patch applied the Author A-Z is kept
Comment 6 Michal Denar 2020-03-01 22:54:03 UTC
Created attachment 99847 [details] [review]
Bug 24219: Preserve sort order when returning to result list

There is a mismatch between sort_cgi, sort and sort_by variables.

 * sort_cgi
I did not find relevant occurrences of sort_cgi in the git log of both
search.pl and results.tt. So it seems that it never worked correctly.
 * sort
It is the JS variable use in browser.js
 * sort_by is the search.pl parameter to set the sort_by option

Test plan:
1. Perform a search in the staff client
2. Change the sort order to something different (try Author A-Z)
3. Click on a result to view the record
4. Click on "Results" button on left side to return to result list
=> Without this patch the result list is sorted by relevancy
=> With this patch applied the Author A-Z is kept

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 7 Nick Clemens (kidclamp) 2020-03-06 11:56:51 UTC
Created attachment 100266 [details] [review]
Bug 24219: Preserve sort order when returning to result list

There is a mismatch between sort_cgi, sort and sort_by variables.

 * sort_cgi
I did not find relevant occurrences of sort_cgi in the git log of both
search.pl and results.tt. So it seems that it never worked correctly.
 * sort
It is the JS variable use in browser.js
 * sort_by is the search.pl parameter to set the sort_by option

Test plan:
1. Perform a search in the staff client
2. Change the sort order to something different (try Author A-Z)
3. Click on a result to view the record
4. Click on "Results" button on left side to return to result list
=> Without this patch the result list is sorted by relevancy
=> With this patch applied the Author A-Z is kept

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Martin Renvoize (ashimema) 2020-03-06 15:02:39 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 9 Joy Nelson 2020-04-02 16:22:47 UTC
does not apply to 19.11.x branch.  please rebase if needed.