From 530abc4ae256dc0542b094627a6f4802e369d3e0 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 4 Apr 2024 01:56:39 +0000 Subject: [PATCH] Bug 36509: Add Search ID tab to authorities search on staff interface This patch makes use of the existing local-number index on the 001 authority field so that authority records can be searched using the 001 ID. This patch works for both Elasticsearch and Zebra search engines. To test: 1. Spin up your ktd with elasticsearch `ktd --es7 up` 2. In the staff interface, open up Koha Administration and search for the SearchEngine system preference. It should be set to Elasticsearch. 3. In another tab, open the staff interface and go to Authorities. 4. Do a normal authorities search, confirm that when you expand the dropdown to order by 'none', the results appear to be in authority-ID ascending order. 5. Choose an ID and go to new the Search ID tab. Search for your ID, confirm it shows as expected. 6. Back in the Koha Administration tab, change the SearchEngine to Zebra. 7. In your Authorities tab, refresh the page. 8. Repeat step 5 and confirm that you can search for the authority by its ID again. Sponsored-by: Education Services Australia SCIS --- .../Elasticsearch/QueryBuilder.pm | 3 +- .../searchengine/elasticsearch/mappings.yaml | 2 +- .../prog/en/includes/authorities-search.inc | 28 +++++++++++++++++++ .../prog/en/includes/authorities_js.inc | 2 ++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index edde18cc09d..ac53ccc0fce 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -514,7 +514,7 @@ Arguments: =item marclist An arrayref containing where the particular term should be searched for. -Options are: mainmainentry, mainentry, match, match-heading, see-from, and +Options are: mainmainentry, mainentry, match, match-heading, see-from, local-number, and thesaurus. If left blank, any field is used. =item and_or @@ -563,6 +563,7 @@ our $koha_to_index_name = { thesaurus => 'subject-heading-thesaurus', 'thesaurus-conventions' => 'subject-heading-thesaurus-conventions', any => '', + 'local-number' => 'local-number', all => '' }; diff --git a/admin/searchengine/elasticsearch/mappings.yaml b/admin/searchengine/elasticsearch/mappings.yaml index 9cd3db5c967..570bfa83810 100644 --- a/admin/searchengine/elasticsearch/mappings.yaml +++ b/admin/searchengine/elasticsearch/mappings.yaml @@ -910,7 +910,7 @@ authorities: suggestible: '' opac: 1 staff_client: 1 - type: number + type: '' personal-name: label: personal-name mandatory: ~ diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc index 87fd69c7c51..4ebb14fbe06 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc @@ -153,6 +153,31 @@ [% END # /tab_panel %] + [% WRAPPER tab_panel tabname="search_id" %] +
+ + + + +
+ +
+ +
+ + +
+ + + +
+ [% INCLUDE authtype %] + [% INCLUDE operator %] + [% INCLUDE orderby %] +
+
+ [% END # /tab_panel %] + [% WRAPPER tab_panel tabname="entire_record" %]
@@ -191,6 +216,9 @@ [% WRAPPER tab_item tabname= "matchheading_search" %] All headings [% END %] + [% WRAPPER tab_item tabname= "search_id" %] + Search ID + [% END %] [% WRAPPER tab_item tabname= "entire_record" %] Entire record [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc index 9b2ca85c9bc..dab9de52b19 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc @@ -71,6 +71,8 @@ $(document).ready(function () { $("#header_search a[href='#main_heading']").tab("show"); } else if ('match' == searchType) { $("#header_search a[href='#matchheading_search']").tab("show"); + } else if ('local-number' == searchType) { + $("#header_search a[href='#search_id']").tab("show"); } else if ('all' == searchType) { $("#header_search a[href='#entire_record']").tab("show"); } -- 2.30.2