Bug 35728

Summary: Add option to NOT redirect to result when search returns only one record
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: SearchingAssignee: Aleisha Amohia <aleisha>
Status: RESOLVED FIXED QA Contact: Nick Clemens (kidclamp) <nick>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, cbrannon, david, dcook, fridolin.somers, kebliss, magnus, nick
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=1610
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/897
Text to go in the release notes:
This enhancement to catalog searching enables choosing what happens for a single search result (for both the OPAC and staff interface): redirect to the record details page (the current behavour), or show only one result. New system preference RedirectToSoleResult is used to manage this (enabled by default to match Koha's current behaviour).
Version(s) released in:
24.05.00
Circulation function:
Attachments: Bug 35728: Add ability to NOT redirect to result when search returns only one record
Bug 35728: Add RedirectToSoleResult system preference
Bug 35728: Add ability to NOT redirect to result when search returns only one record
Bug 35728: Add RedirectToSoleResult system preference
Bug 35728: Add ability to NOT redirect to result when search returns only one record
Bug 35728: Add RedirectToSoleResult system preference
Bug 35728: Add ability to NOT redirect to result when search returns only one record

Description Aleisha Amohia 2024-01-08 22:47:46 UTC

    
Comment 1 Aleisha Amohia 2024-01-08 23:13:59 UTC
Created attachment 160668 [details] [review]
Bug 35728: Add ability to NOT redirect to result when search returns only one record

This enhancement adds a new system preference RedirectToSoleResult. By default it is enabled, which matches current behaviour - to redirect to the detail page if it is the only search result.

To test:

1) Apply the patch, install database updates, restart services.
2) Go to Koha Administration -> Global system preferences. The RedirectToSoleResult system preference is in the Searching tab. Confirm it is enabled (set to "Redirect") by default.
3) Conduct a catalogue search on the staff interface that you know will return a single result. Confirm you are redirected to the detail page.
4) Do the same search on the OPAC. Confirm you are redirected to the detail page.
5) Go back to the system preferences and disable the RedirectToSoleResult system preference by setting it to "Don't redirect"
6) Do the searches again on the staff interface and OPAC. Confirm you are NOT redirected to the detail page, and the search results page shows as expected.

Sponsored-by: Education Services Australia SCIS
Comment 2 David Nind 2024-01-09 05:26:38 UTC
Hi Aleisha.

I like this!

It looks like the patch(es) with the database update/system preference addition is missing...

David

Testing notes (using KTD and the sample data):

1. Search for higher-order for a single search result.
Comment 3 Aleisha Amohia 2024-01-09 19:47:05 UTC
Created attachment 160722 [details] [review]
Bug 35728: Add RedirectToSoleResult system preference
Comment 4 Aleisha Amohia 2024-01-09 19:47:07 UTC
Created attachment 160723 [details] [review]
Bug 35728: Add ability to NOT redirect to result when search returns only one record

This enhancement adds a new system preference RedirectToSoleResult. By default it is enabled, which matches current behaviour - to redirect to the detail page if it is the only search result.

To test:

1) Apply the patch, install database updates, restart services.
2) Go to Koha Administration -> Global system preferences. The RedirectToSoleResult system preference is in the Searching tab. Confirm it is enabled (set to "Redirect") by default.
3) Conduct a catalogue search on the staff interface that you know will return a single result. Confirm you are redirected to the detail page.
4) Do the same search on the OPAC. Confirm you are redirected to the detail page.
5) Go back to the system preferences and disable the RedirectToSoleResult system preference by setting it to "Don't redirect"
6) Do the searches again on the staff interface and OPAC. Confirm you are NOT redirected to the detail page, and the search results page shows as expected.

Sponsored-by: Education Services Australia SCIS
Comment 5 Aleisha Amohia 2024-01-09 19:47:28 UTC
(In reply to David Nind from comment #2)
> Hi Aleisha.
> 
> I like this!
> 
> It looks like the patch(es) with the database update/system preference
> addition is missing...
> 
> David

Oops! There you go
Comment 6 David Nind 2024-01-09 20:22:57 UTC
Created attachment 160724 [details] [review]
Bug 35728: Add RedirectToSoleResult system preference

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2024-01-09 20:22:59 UTC
Created attachment 160725 [details] [review]
Bug 35728: Add ability to NOT redirect to result when search returns only one record

This enhancement adds a new system preference RedirectToSoleResult. By default it is enabled, which matches current behaviour - to redirect to the detail page if it is the only search result.

To test:

1) Apply the patch, install database updates, restart services.
2) Go to Koha Administration -> Global system preferences. The RedirectToSoleResult system preference is in the Searching tab. Confirm it is enabled (set to "Redirect") by default.
3) Conduct a catalogue search on the staff interface that you know will return a single result. Confirm you are redirected to the detail page.
4) Do the same search on the OPAC. Confirm you are redirected to the detail page.
5) Go back to the system preferences and disable the RedirectToSoleResult system preference by setting it to "Don't redirect"
6) Do the searches again on the staff interface and OPAC. Confirm you are NOT redirected to the detail page, and the search results page shows as expected.

Sponsored-by: Education Services Australia SCIS
Signed-off-by: David Nind <david@davidnind.com>
Comment 8 Magnus Enger 2024-01-10 07:05:32 UTC
Would it make sense to split this in two, with one syspref for the OPAC and one for staff?
Comment 9 Magnus Enger 2024-01-10 10:04:17 UTC
*** Bug 25885 has been marked as a duplicate of this bug. ***
Comment 10 Aleisha Amohia 2024-01-10 18:51:38 UTC
(In reply to Magnus Enger from comment #8)
> Would it make sense to split this in two, with one syspref for the OPAC and
> one for staff?

I don't think it is necessary at this point. The sponsorship we received didn't require this to be so granular, but it wouldn't be hard to split it out in future if that was desired.
Comment 11 Nick Clemens (kidclamp) 2024-04-01 17:16:09 UTC
Created attachment 164214 [details] [review]
Bug 35728: Add RedirectToSoleResult system preference

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 12 Nick Clemens (kidclamp) 2024-04-01 17:16:11 UTC
Created attachment 164215 [details] [review]
Bug 35728: Add ability to NOT redirect to result when search returns only one record

This enhancement adds a new system preference RedirectToSoleResult. By default it is enabled, which matches current behaviour - to redirect to the detail page if it is the only search result.

To test:

1) Apply the patch, install database updates, restart services.
2) Go to Koha Administration -> Global system preferences. The RedirectToSoleResult system preference is in the Searching tab. Confirm it is enabled (set to "Redirect") by default.
3) Conduct a catalogue search on the staff interface that you know will return a single result. Confirm you are redirected to the detail page.
4) Do the same search on the OPAC. Confirm you are redirected to the detail page.
5) Go back to the system preferences and disable the RedirectToSoleResult system preference by setting it to "Don't redirect"
6) Do the searches again on the staff interface and OPAC. Confirm you are NOT redirected to the detail page, and the search results page shows as expected.

Sponsored-by: Education Services Australia SCIS
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 13 Katrin Fischer 2024-04-26 16:07:07 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 14 Fridolin Somers 2024-05-24 07:55:11 UTC
(In reply to Magnus Enger from comment #8)
> Would it make sense to split this in two, with one syspref for the OPAC and
> one for staff?

+1
Comment 15 Fridolin Somers 2024-05-24 07:55:41 UTC
Not backported to 23.11.x