From f9e2c91a3d1e164bdc2d89ab3c36537281b03952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kula?= <148193449+mkibp@users.noreply.github.com> Date: Wed, 30 Oct 2024 13:09:54 +0000 Subject: [PATCH] Bug 36437: add pub year facet to Elasticsearch Notes: - I labeled it as "Year of publication" instead of "Date of publication" since it seems to be more occurate (since the field is a year and that's gonna be better to translate to other langauge) - the third word is not capitalized, since I'm following the naming convention of existing facet labels - facet_order was set to 3, since that should be a pretty common field and useful to display high up to get a quick idea for the range of years the results are from Test plan: 0. Ensure Elasticsearch index is rebuilt (should be on fresh ktd startup?) 1. On intranet go to /cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl 2. Go to second tab there 3. Ensure date-of-publication is in the table, has label in parentheses, has facetable set to Yes 4. Scrolldown to the order of facets table 5. Ensure date-of-publication is there, has label, is third on the list 6. Search for something in intranet, ensure the facet is visible, its value is year, it's clickable and working 7. Search for something in OPAC, as above ensure it works (important to check both OPAC and intranet since facets use different templates to display in both...) --- .../searchengine/elasticsearch/mappings.yaml | 21 ++++++++++--------- .../intranet-tmpl/prog/en/includes/facets.inc | 2 ++ .../searchengine/elasticsearch/mappings.tt | 1 + .../bootstrap/en/includes/opac-facets.inc | 2 ++ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/admin/searchengine/elasticsearch/mappings.yaml b/admin/searchengine/elasticsearch/mappings.yaml index f1bfdbe916..302418d41e 100644 --- a/admin/searchengine/elasticsearch/mappings.yaml +++ b/admin/searchengine/elasticsearch/mappings.yaml @@ -1341,7 +1341,7 @@ biblios: staff_client: 1 type: '' ccode: - facet_order: 7 + facet_order: 8 label: Collections mandatory: ~ mappings: @@ -1717,15 +1717,16 @@ biblios: staff_client: 1 type: date date-of-publication: - label: date-of-publication + facet_order: 3 + label: Year of publication mandatory: ~ mappings: - - facet: '' + - facet: 1 marc_field: 008_/7-10 marc_type: marc21 sort: 1 suggestible: '' - - facet: '' + - facet: 1 marc_field: 100a_/9-12 marc_type: unimarc sort: 1 @@ -1935,7 +1936,7 @@ biblios: suggestible: '' type: geo_point holdingbranch: - facet_order: 8 + facet_order: 9 label: Holding libraries mandatory: ~ mappings: @@ -1953,7 +1954,7 @@ biblios: staff_client: 1 type: string homebranch: - facet_order: 9 + facet_order: 10 label: Home libraries mandatory: ~ mappings: @@ -2607,7 +2608,7 @@ biblios: staff_client: 1 type: '' ln: - facet_order: 10 + facet_order: 11 label: Languages mandatory: ~ mappings: @@ -2693,7 +2694,7 @@ biblios: staff_client: 1 type: number location: - facet_order: 3 + facet_order: 4 label: Location mandatory: ~ mappings: @@ -3531,7 +3532,7 @@ biblios: staff_client: 1 type: '' su-geo: - facet_order: 4 + facet_order: 5 label: Places mandatory: ~ mappings: @@ -4311,7 +4312,7 @@ biblios: staff_client: 1 type: '' title-series: - facet_order: 5 + facet_order: 6 label: Series mandatory: ~ mappings: diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc index 2e54fcb523..0081005f46 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc @@ -55,6 +55,8 @@ Titles + [% CASE 'Year of publication' %] + Year of publication [% CASE 'Topics' %] Topics [% CASE 'Places' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt index 2f3d4f0417..ae39f534df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt @@ -516,6 +516,7 @@ a.add, a.delete { [% SWITCH f.label %] [% CASE 'Authors' %]Authors [% CASE 'Item types' %]Item types + [% CASE 'Year of publication' %]Year of publication [% CASE 'Locations' %]Locations [% CASE 'Places' %]Places [% CASE 'Series' %]Series diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc index b133c530f8..7d89d61594 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc @@ -47,6 +47,8 @@
[% CASE 'Titles' %]