Bug 32488 - Add search engine indexes for content, media and carrier type (MARC21)
Summary: Add search engine indexes for content, media and carrier type (MARC21)
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-19 09:23 UTC by Mathieu Saby
Modified: 2026-01-14 07:41 UTC (History)
5 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 32488: Add RDA content, media, and carrier fields to ES mappings MARC21 (2.42 KB, patch)
2025-04-25 11:32 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32488: Zebra updates and aliases (7.20 KB, patch)
2025-05-07 15:57 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32488: Add RDA content, media, and carrier fields to ES mappings MARC21 (2.47 KB, patch)
2026-01-14 07:40 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32488: Zebra updates and aliases (7.26 KB, patch)
2026-01-14 07:40 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32488: (follow-up) Zebra: Fix mapping of ports to indexes (1.13 KB, patch)
2026-01-14 07:40 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Saby 2022-12-19 09:23:27 UTC
I don't think there are indexes for those MARC21 fields
336 - Content Type (R)
337 - Media Type (R)
338 - Carrier Type (R)

nor for their UNIMARC equivalent
181 - Content form
182 - Media type
183 - type of carrier

It could be nice to add those indexes and to add the ability to use them in advanced search
Comment 1 Nick Clemens (kidclamp) 2025-04-25 11:32:44 UTC
Created attachment 181505 [details] [review]
Bug 32488: Add RDA content, media, and carrier fields to ES mappings MARC21
Comment 2 Nick Clemens (kidclamp) 2025-04-25 11:33:56 UTC
I didn't add the UNIMARC mappings, they seem to be much more specifically coded, so I am not sure if they can go into the same fields.

Possibly we want a bug for each MARC flavour?
Comment 3 Mathieu Saby 2025-04-25 14:27:03 UTC
I can take care of a followup for Unimarc in an other bug ;-)
Comment 4 Mathieu Saby 2025-04-25 14:28:33 UTC
But you added it only for Elasticsearch. Should we not also add it for Zebra ?
Comment 5 David Cook 2025-05-04 23:16:13 UTC
(In reply to Mathieu Saby from comment #4)
> But you added it only for Elasticsearch. Should we not also add it for Zebra
> ?

+1 I think so too
Comment 6 Nick Clemens (kidclamp) 2025-05-07 15:57:55 UTC
Created attachment 182034 [details] [review]
Bug 32488: Zebra updates and aliases
Comment 7 Nick Clemens (kidclamp) 2025-05-07 15:58:26 UTC
(In reply to David Cook from comment #5)
> (In reply to Mathieu Saby from comment #4)
> > But you added it only for Elasticsearch. Should we not also add it for Zebra
> > ?
> 
> +1 I think so too

Added, but I can't make them work, tossing them here for other eyes, been a while since I touched zebra
Comment 8 Katrin Fischer 2025-05-07 16:13:01 UTC
This looks ok, I think. 

Have you:

1) Copied the files into the right place in ktd?

Something like this I believe:

sudo cp -i etc/zebradb/biblios/etc/bib1.att /etc/koha/zebradb/biblios/etc/bib1.att 
sudo cp -i etc/zebradb/ccl.properties /etc/koha/zebradb/ccl.properties 
sudo cp -i etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl

2) Restarted Zebra?
Comment 9 David Nind 2025-09-04 14:40:43 UTC
I've tested the Elasticsearch changes, and these work, so happy to sign off.

Not sure how to test the Zebra changes.

Elasticsearch testing notes (using KTD):
1. Start up KTD with ES7: ktd --es7 up
2. Go to Koha administration > Catalog > Search engine configuration (Elasticsearch) > Bibliohgraphic records
3. Search the page for 336, 337, and 338
4. Note that there are no search field mappings for this tag
5. Apply the patch
6. Either reset everything (reset_all) or from the staff interface (Reset mappings)
7. Note that these new mappings are in place:
   . content-type-code: 336b
   . content-type-term: 336a
   . media-type-code: 337b
   . media-type-term: 337a
   . carrier-type-code: 338b
   . carrier-type-term: 338a
Comment 10 Katrin Fischer 2026-01-14 07:40:13 UTC
Created attachment 191400 [details] [review]
Bug 32488: Add RDA content, media, and carrier fields to ES mappings MARC21

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2026-01-14 07:40:16 UTC
Created attachment 191401 [details] [review]
Bug 32488: Zebra updates and aliases

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Katrin Fischer 2026-01-14 07:40:18 UTC
Created attachment 191402 [details] [review]
Bug 32488: (follow-up) Zebra: Fix mapping of ports to indexes

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2026-01-14 07:41:10 UTC
1) QA checks - pass.
2) Code review - nothing found
3) Testing

a) Zebra

sudo cp -i etc/zebradb/biblios/etc/bib1.att /etc/koha/zebradb/biblios/etc/bib1.att 
sudo cp -i etc/zebradb/ccl.properties /etc/koha/zebradb/ccl.properties 
sudo cp -i etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
sudo koha-zebra --restart kohadev
Edit record, add fields, save

This gave me some headache since my searches still wouldn't work. 

The issue is here:

+Media-type-term 1=9020
+mett Media-type-term
+Media-type-code 1=9021
+metc Media-type-code

+att 9020    Media-type-code
+att 9021    Media-type-term

Ports have been switched. Fixed in a follow-up.

b) Elasticsearch
Worked nicely.

4) Notes
UNIMARC mappings are still missing. I have filed a new bug report: bug 41610