From d05f25dcbc5d3cc5dfcc82ed9806ae1949532715 Mon Sep 17 00:00:00 2001 From: Petro Vashchuk Date: Tue, 29 Apr 2025 12:55:13 +0300 Subject: [PATCH] Bug 39770: Fix wrong Braille format search for Elasticsearch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ElasticSearch couldn't find any books that have Braille: No results match your search with limit(s): 'ff7-01-02:("tc or fb")'. It was a problem because the "l-format:tc or fb" only works for Zebra and is incorrect way to search with OR for ElasticSearch. Elastic requires the syntax to be l-format:"tc" OR "fb” (uppercase OR and each format in double quotes) instead. This patch fixes it by checking which search engine you use depending on the current syspref SearchEngine and provides the correctly formatted format. To reproduce: 1. Have ElasticSearch enabled and check that you have books with braille, or make up one yourself by adding "tc" (text - Braille) or "fb" (tactile material - braille) to 007 MARC field. 2. Go to catalogue/advanced search and select format: braille, from the dropdown. 3. Try to find anything, if you are using ElasticSearch you will see: No results match your search with limit(s): 'ff7-01-02:("tc or fb")' 4. Do the same with Zebra instead of Elastic, it should work properly and you should see all the books that have Braille. 5. Apply the patch. 6. Repeat same search both using ElasticSearch and then Zebra. Both ElasticSearch and Zebra should work without any issues. --- .../prog/en/includes/subtype_limits.inc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/subtype_limits.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/subtype_limits.inc index 01712ec06c7..07efc0ee87b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/subtype_limits.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/subtype_limits.inc @@ -101,10 +101,18 @@ [% ELSE %] [% END %] - [% IF (limits.$lformat.0 == 'tc or fb' ) %] - - [% ELSE %] - + [% IF (Koha.Preference('SearchEngine') == 'Elasticsearch') %] + [% IF (limits.$lformat.0 == 'tc OR fb') %] + + [% ELSE %] + + [% END %] + [% ELSE %] + [% IF (limits.$lformat.0 == 'tc or fb') %] + + [% ELSE %] + + [% END %] [% END %] [% IF (limits.$lformat.0 == 'sd' ) %] -- 2.49.0