Bug 36434 - Use a keyword that will be secretly included in all OPAC bibliographic and authority searches
Summary: Use a keyword that will be secretly included in all OPAC bibliographic and au...
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-27 01:09 UTC by Aleisha Amohia
Modified: 2024-04-04 21:02 UTC (History)
5 users (show)

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


Attachments
Bug 36434: Use a keyword that will be secretly included in all OPAC bibliographic and authority searches (7.72 KB, patch)
2024-03-27 01:57 UTC, Aleisha Amohia
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2024-03-27 01:09:10 UTC
Libraries might repurpose their OPAC to only search certain records.

These records might still have relevant collection, item type, shelving location information, so it doesn't work to use these fields to filter OPAC searches on.

It might be easier to add a 'keyword' to the MARC for these records, and have Koha secretly apply this keyword to the search, when switched on.
Comment 1 Aleisha Amohia 2024-03-27 01:57:10 UTC
Created attachment 163969 [details] [review]
Bug 36434: Use a keyword that will be secretly included in all OPAC bibliographic and authority searches

When a keyword is provided to the new OPACAlwaysSearchKeyword system preference, Koha will secretly add this to all OPAC searches (both bibliographic and authority) to help limit results.

Note: This will have unexpected results if authority searches are done with 'starts with' or 'is exactly'. It is only designed to work with 'contains'.

To test:

1. Install database updates and restart services.
2. Do a standard OPAC search using the main search bar for 'this that'. Notice the number of results.
3. Do an advanced OPAC search, specify keyword: 'this' and keyword: 'that'. Notice the number of results.
4. In the staff interface, do a biblio search for 'this that'. Edit the first two records, and put your test keyword somewhere in the MARC, perhaps a note field 5XX.
5. Go to the Koha Administration -> System preferences and search for OPACAlwaysSearchKeyword. Add your test keyword to the syspref and Save.
6. Repeat steps 2 and 3. Confirm results are returned, and there should only be your two records which you added the test keyword to.
7. Remove the test keyword from OPACAlwaysSearchKeyword and Save.

8. Do an OPAC authority search for 'series'. Notice the number of results.
9. In the staff interface, do an authority search for 'series'. Edit the first two records, and put your test keyword somewhere in the MARC, perhaps in the 040$f.
10. Repeat step 5.
11. Repeat steps 8 and 9. Confirm results are returned, and there should only be your two records which you added the test keyword to.

12. Click on 'Welcome, your name' in the top right of the OPAC and go to your search history. Confirm the test keyword added to OPACAlwaysSearchKeyword does NOT show in your history, for both catalog and authority searches.

13. Confirm all results are returned as normal when OPACAlwaysSearchKeyword is empty.

Sponsored-by: Auckland University of Technology
Comment 2 Anneli Österman 2024-03-27 10:47:57 UTC
I'm not sure I understand the purpose of this  feature. Is this something like what you could do with OpacHiddenItems system preference?
Comment 3 Anneli Österman 2024-03-27 11:18:15 UTC
Or with OpacSuppression system preference and suppress information in biblio record's 942$n field?
Comment 4 Donna 2024-03-27 19:39:24 UTC
Why couldn't the term just be included as a very specific subject heading or authority?
Comment 5 Lucas Gass 2024-03-27 19:45:30 UTC
Can you explain the use case for this a bit more? 

Personally Im not a fan of "secertly" doing things that effect patron's searches. I think this hurts findability/disoverability for patrons. 

Maybe outlining a use case for us will help understand why this is needed.
Comment 6 Aleisha Amohia 2024-03-27 20:08:04 UTC
In our case we have a library wanting to use their OPAC just for their archives collection.

They use VuFind on top of Koha for searching their regular collection.

By default, we want the OPAC to exclude the regular collection from searches. This isn't as simple as using OpacHiddenItems because if the record doesn't have holdings then it won't be used. We can't filter based on item types and collection codes because archives items still use these, just like the normal collection. We also can't use OpacSuppression or the 942$n on the regular holdings or they'll be excluded from the VuFind harvest. 

Hopefully that explains the use case. Open to ideas on better ways to do this, for e.g. we could put the OPACAlwaysSearchKeyword back in the search history so the user knows about it.
Comment 7 Esther Melander 2024-03-28 15:34:24 UTC
The concern with this approach is the potential for abuse over time. Search engines have been accused of such things for years.

OpacHiddenItems can hide the one collection in the Koha OPAC. What is available for display/use in the Discovery Layer depends on how the discovery layer handles the OpacHiddenItems flag. It is perhaps better handled at the discovery layer level and not Koha directly.
Comment 8 Aleisha Amohia 2024-04-02 01:23:33 UTC
I understand the concerns.

The issue for us is that we can't use OpacHiddenItems to exclude everything except our archives, because the discovery layer includes OpacHiddenItems in the harvest.

The OPAC will be used to search opposite records from the discovery layer.

This is a niche use case so if it is too risky to upstream then that's totally fine, we can maintain it as a customisation for this library. Please feel free to change bug status.
Comment 9 Nick Clemens (kidclamp) 2024-04-04 17:35:07 UTC
Just curious, what is the keyword you are using/where is it stored in the MARC record?

Koha technically does use a forced hidden keyword in searching for suppressed records - we append 'suppress=0' for opac searches.

Maybe if this cannot be handled through the current suppression module, the development could extend the fields used to define suppression and allow for another field/value to be suppressed? At least with Elasticsearch this should be easily configurable out of the box
Comment 10 Aleisha Amohia 2024-04-04 21:02:21 UTC
We're putting a keyword like 'archive' in records that must not go through to the discovery layer, and must be searchable on the OPAC.

That sounds like an interesting idea