https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44387 --- Comment #2 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 212989 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212989&action=edit Bug 44387: Index each nature of contents code of ctype separately in Elasticsearch The ctype index (content type limit of the advanced search) is mapped to the whole range of nature of contents codes: 008_/24-27 in MARC21 and 105a_/4-7 in UNIMARC. These positions hold up to four independent one-character codes, but Elasticsearch indexes them as a single token, so a record with "be " (bibliography and encyclopedia) is only found with ctype:be, and not with ctype:b nor ctype:e. Zebra is not affected: the ctype CCL qualifier uses left and right truncation (t=b), so ctype=b matches "be". This patch maps each position separately: 008_/24-27 is replaced by 008_/24, 008_/25, 008_/26 and 008_/27, and 105a_/4-7 by 105a_/4 to 105a_/7. A database update changes the existing mappings, only if they have not been modified. Steps to follow (Elasticsearch, MARC21): 1. Edit a book record and set 008/24-27 (Nature of contents) to "be" (Bibliographies, Encyclopedias). Edit another one and set it to "b". 2. Advanced search > Limits > Content: select "Bibliographies", search. Only the second record is found. With "Encyclopedias", none of them is found. 3. Apply the patch, run updatedatabase and note the message about the ctype mapping. 4. Administration > Search engine configuration (Elasticsearch): note that ctype is now mapped to 008_/24, 008_/25, 008_/26 and 008_/27. 5. Reindex: misc/search_tools/rebuild_elasticsearch.pl -b -d 6. Repeat 2: "Bibliographies" finds both records, "Encyclopedias" finds the first one. -- You are receiving this mail because: You are watching all bug changes.