Bug 37871: Remove extraneous 246 subfields from the title mappings (Elasticsearch, MARC21)
This patch limits indexing of field 246 to $a, $b, $n, and $p in
various title indexes.
Previously, all 246 subfields were indexed, including non-title
subfields such as $i (Display text), $g (Miscellaneous information),
and linking subfields, making the title index very large and giving
false results.
To test:
1. Add all the 246 subfields to the default bibliographic framework
1.1. Go to Administration > MARC bibliographic framework
1.2. Click Actions > MARC structure next to the Default framework
1.3. Search for 246
1.4. Click Actions > Edit subfields
1.5. For each subfield, make sure Editor is checked
1.6. Click Save changes
2. Create a new record and fill out all the 246 subfields
2.1. Go to Cataloging
2.2. Click New record
2.3. Fill out the mandatory fields (000, 003, 005, 008, 040$c,
245$a, 942$c)
2.4. Fill out all the subfields in 246 (I simply write the name of
the subfield in the text field e.g. Display text in 246$i)
2.5. Click Save
2.6. Click Normal to access the detailed record
3. View the Elastic search record
--> All the subfields (including "Display text", "Miscellaneous
information" and other non-title subfields) should be indexed in
- title
- title__suggestion
- title-abbreviated
- title-abbreviated__sort
- title expanded
- title-expanded__sort
- title-former
- title-former__sort
4. Make a title or keyword search for "Display" (or whatever you wrote
in 246$i)
--> Your record should be in the results
5. Apply patch
6. Rebuild the index using -r
koha-elasticsearch --rebuild -d -r -v kohadev
7. Redo step 3
--> Only 246 $a, $b, $n, and $p should be indexed
8. Redo step 4
--> Your record should NOT be in the results
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>