[Koha-bugs] [Bug 29578] New: Search term highlighting breaks with titles containing characters with Greek diacritics

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 26 11:54:21 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29578

            Bug ID: 29578
           Summary: Search term highlighting breaks with titles containing
                    characters with Greek diacritics
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: OPAC
          Assignee: oleonard at myacpl.org
          Reporter: a.roussos at dataly.gr
        QA Contact: testopia at bugs.koha-community.org

The commits from Bug 5844 and Bug 20501 fixed the problem of DOM content
disappearing from the results of OPAC/Staff Client searches under certain
conditions (e.g. when the search terms were "magaz mag" or "the the").

However, there is still a case where the jQuery term highlighter can break,
and in the process actually make the "Highlight"/"Unhighlight" button
disappear altogether!

To reproduce, catalogue two books using the titles below, one of which
includes a word ("τοῖς") [1] containing Greek diacritics:

Title #1: Συλλογής των εν επιτομή τοῖς πάλαι γεωγραφηθέντων
Title #2: Επιτομή της ιστορίας των Βαλκανικών Πολέμων (1912-1913)

Then, perform a catalog search for "επιτομή των" (without the quotes).

You should get what is depicted in the attached screenshots. Notice how
1) the "Highlight"/"Unhighlight" button has disappeared, and
2) not all search terms are highlighted (e.g. "των" in the 2nd result)

If using Firefox, in the Browser Console the following error will be logged:

Uncaught DOMException: Index or size is negative or greater than the allowed
amount

The offending file is
koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js, line
26:

 26     var endbit = middlebit.splitText(pat.length);

Upgrading the plugin from its current version (v3) to the latest version
available [1] from the developer (v5) fixes the problem.

Please note that the changes to this script from commit 2e4b574074 should
also be incorporated.

[1] https://en.wiktionary.org/wiki/%CF%84%CE%BF%E1%BF%96%CF%82
[2]
https://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list