Bug 25885

Summary: Show list of hits for one search result
Product: Koha Reporter: Christopher Brannon <cbrannon>
Component: SearchingAssignee: Magnus Enger <magnus>
Status: RESOLVED DUPLICATE QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: dcook, lucas, m.de.rooy, magnus, sally.healey
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 25885 - Show list of hits for one search result
Bug 25885 - Show list of hits for one search result

Description Christopher Brannon 2020-06-26 22:07:36 UTC
I would like to suggest, if you have OverDrive (or other 3rd party databases) enabled on Koha, that Koha NOT push you straight into a record (detail.pl) if there is only one "Koha" result.  You end up not being able to see OverDrive results, or switch over to OverDrive when it does that.  Makes the connectivity useless for those with pin-point searching skills.

When you enable one of these databases, that should be all you need to disable the default Koha behavior.
Comment 1 Magnus Enger 2021-04-26 12:02:27 UTC
I know there are people who dislike the "if one result, go directly to it" functionality, without using OverDrive. So perhaps there could be a setting to disable just that, independently of other settings?
Comment 2 Christopher Brannon 2021-04-26 15:12:43 UTC
Can you think of any reason a library would choose to have a database (that they are probably paying for), and still want it to be bypassed and the search result go straight into the record?  If so, then yes, having a separate control makes sense.  But if not, why add another control?  I can't think of any good reason to add more controls.  It seems to complicate the desired affect, and makes more work for those that setup and manage the system.  I think having this behavior disabled if a database is turned on if it produces a result on the results page.  That is straight forward and logical, and the least amount of work for setup, and for troubleshooting.
Comment 3 Magnus Enger 2021-04-27 06:31:47 UTC
Well, my thought was that are libraries that do not have OverDrive (or similar) who want to turn off the "if one result, go directly to it" functionality.
Comment 4 Christopher Brannon 2021-04-27 14:51:09 UTC
Well, there we have it.  A great reason for a separate pref.  :)  Thanks for that.  I'm on board with a separate pref then.
Comment 5 Magnus Enger 2021-05-03 13:10:39 UTC
A library has asked me to implement this, at least for the OPAC. Any suggestions for what the syspref should be called?
Comment 6 Magnus Enger 2021-05-03 13:21:22 UTC
Would something like OPACShowResultListOfOne work? 

OPACShowResultListOfOne = 0 => Current behaviour, go directly to detail view if there is only one hit

OPACShowResultListOfOne = 1 => New behaviour, show the result list even if there is only one hit. 

And then:

OPACShowResultListOfOne [Show|Don't show] the result list in a bibliographic search, if there is only one hit.

Where 

Show = 1
Don't show = 0
Comment 7 Christopher Brannon 2021-05-04 14:41:57 UTC
(In reply to Magnus Enger from comment #6)
> Would something like OPACShowResultListOfOne work? 
> 
> OPACShowResultListOfOne = 0 => Current behaviour, go directly to detail view
> if there is only one hit
> 
> OPACShowResultListOfOne = 1 => New behaviour, show the result list even if
> there is only one hit. 
> 
> And then:
> 
> OPACShowResultListOfOne [Show|Don't show] the result list in a bibliographic
> search, if there is only one hit.
> 
> Where 
> 
> Show = 1
> Don't show = 0

Looks good.  You could also go with OPACAlwaysShowResults.  Either would work, the latter being less specific.
Comment 8 Magnus Enger 2021-05-06 10:49:50 UTC Comment hidden (obsolete)
Comment 9 Lucas Gass (lukeg) 2021-05-10 20:46:23 UTC
Created attachment 120811 [details] [review]
Bug 25885 - Show list of hits for one search result

Default behaviour in Koha, for a bibliographic search that
returns one hit is to skip the result list and go straight
to the detail view of that one hit. This patch makes this
behaviour configurable.

To test:
- Make sure you can do a search that returns exactly one hit
- Apply this patch
- Do the search and verify the default behaviour of skipping
  the result list and going straight to detail view is in place
- Toggle the OPACShowResultListOfOne syspref and make sure the
  behaviour corresponds to the setting.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 10 Lucas Gass (lukeg) 2021-05-10 20:47:44 UTC
Everything works good here and I'm signing off. One thing, the QA tool doesn't like the commit message because there is no ':' after 'Bug 25885'.
Comment 11 Marcel de Rooy 2021-07-09 09:15:25 UTC
Your search returned 1 results.
Comment 12 Marcel de Rooy 2021-07-09 09:16:21 UTC
Looks good. Please address comments 10 and 11.
Comment 13 Magnus Enger 2024-01-10 10:04:17 UTC

*** This bug has been marked as a duplicate of bug 35728 ***