From 77f300fa8c52b40ad96dd788ef3721e8ff84c541 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 ac161e50fd7..23c36c7617b 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -503,7 +503,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 @@ -552,6 +552,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 929f2f94103..4f9c508990e 100644 --- a/admin/searchengine/elasticsearch/mappings.yaml +++ b/admin/searchengine/elasticsearch/mappings.yaml @@ -947,7 +947,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 542ba1ae1ce..48de405b125 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc @@ -70,6 +70,8 @@ $(document).ready(function () { $("#header_search a[href='#main_heading_panel']").tab("show"); } else if ('match' == searchType.valueOf()) { $("#header_search a[href='#matchheading_search_panel']").tab("show"); + } else if ('local-number' == searchType.valueOf()) { + $("#header_search a[href='#search_id_panel']").tab("show"); } else if ('all' == searchType.valueOf()) { $("#header_search a[href='#entire_record_panel']").tab("show"); } -- 2.39.2