Bug 29578 - Search term highlighting breaks with titles containing characters with Greek diacritics
Summary: Search term highlighting breaks with titles containing characters with Greek ...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Andreas Roussos
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-26 10:54 UTC by Andreas Roussos
Modified: 2023-12-28 20:46 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes an issue with the term highlighter which is used during catalog searches in both the OPAC and the Staff interface. Under certain conditions (searching for titles containing characters with Greek diacritics), the jQuery term highlighter would break and in the process make the "Highlight" / "Unhighlight" button disappear altogether. UNIMARC instances were affected the most by this.
Version(s) released in:
23.11.00,23.05.04,22.11.10


Attachments
search term highlighting broken in the OPAC (27.01 KB, image/png)
2021-11-26 10:56 UTC, Andreas Roussos
Details
search term highlighting broken in the Staff Client (15.50 KB, image/png)
2021-11-26 10:56 UTC, Andreas Roussos
Details
Bug 29578: Upgrade the jQuery highlighter plugin (3.71 KB, patch)
2021-11-27 06:54 UTC, Andreas Roussos
Details | Diff | Splinter Review
Bug 29578 - Screenshots from testing 2021-11028 (305.79 KB, application/pdf)
2021-11-27 23:14 UTC, David Nind
Details
OPAC highlight button disappearing on Ubuntu Firefox (97.59 KB, image/png)
2021-11-29 11:42 UTC, Andreas Roussos
Details
OPAC highlight button disappearing on Ubuntu Google Chrome (87.51 KB, image/png)
2021-11-29 11:42 UTC, Andreas Roussos
Details
Bug 29578: Upgrade the jQuery highlighter plugin (3.80 KB, patch)
2021-12-02 10:48 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 29048: Fix link to linked records from authority search results in OPAC (2.37 KB, patch)
2022-02-27 00:14 UTC, Katrin Fischer
Details | Diff | Splinter Review
OPAC highlight button disappearing (UNIMARC instance on current master) (79.26 KB, image/png)
2023-02-21 20:23 UTC, Andreas Roussos
Details
Staff interface term highlighting partially broken (UNIMARC instance on current master) (49.71 KB, image/png)
2023-02-21 20:24 UTC, Andreas Roussos
Details
Bug 29578: Upgrade the jQuery highlighter plugin (8.94 KB, patch)
2023-02-21 20:26 UTC, Andreas Roussos
Details | Diff | Splinter Review
Bug 29578: Upgrade the jQuery highlighter plugin (7.99 KB, patch)
2023-08-02 01:32 UTC, Andreas Roussos
Details | Diff | Splinter Review
Bug 29578: Upgrade the jQuery highlighter plugin (8.05 KB, patch)
2023-08-17 08:09 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 29578: Upgrade the jQuery highlighter plugin (8.10 KB, patch)
2023-08-25 12:17 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 Andreas Roussos 2021-11-26 10:54:21 UTC
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
Comment 1 Andreas Roussos 2021-11-26 10:56:21 UTC
Created attachment 128034 [details]
search term highlighting broken in the OPAC
Comment 2 Andreas Roussos 2021-11-26 10:56:34 UTC
Created attachment 128035 [details]
search term highlighting broken in the Staff Client
Comment 3 Andreas Roussos 2021-11-27 06:54:12 UTC Comment hidden (obsolete)
Comment 4 David Nind 2021-11-27 23:14:49 UTC
Created attachment 128055 [details]
Bug 29578 - Screenshots from testing 2021-11028

I attempted to test this (using koha-testing-docker on master) but I didn't get the same results. My observations:

1. Before the patch is applied: in the OPAC and staff interface I am not seeing the Unhighlight and Highlight button disappearing as reported. These appear fine for me (using Firefox and Google Chrome on Ubuntu 18.04). The highlighting on the search results page also looks okay to me - see the screenshots in the attachment (note: I just changed the titles for existing records).

2. OPAC details page (clicking through from the search results page): 
   . Before the patch is applied I do see the issue with words not being highlighted on the detail page. 
   . After the patch is applied this fixes this, and for "normal" searches highlighting continues to work as expected.

3. Staff interface details page (clicking through from the search results page): both before and after the patch is applied search words are not highlighted on the details page for a record (not sure if this is the expected behavour or not - "normal" words are not highlighted either).

Not related to this bug, but in the OPAC I do not see the browse results block (Browse results, Previous, Back to results, Next) on the right hand side on the detail page when using Google Chrome - it displays fine using Firefox. See the attachment. I have logged bug 29582 for this.
Comment 5 Andreas Roussos 2021-11-29 11:41:08 UTC
Hi David!

Thank you very much for your interest in this bug report, and the detailed
response with your findings.

My screenshots were taken using Firefox 94.0.2 on Windows 10 64-bit.

Today I fired up an Ubuntu 18.04.6 LTS Desktop in a Virtual Machine, and
using the live session user (i.e. no O/S install was performed) I was
actually able to reproduce the problem outlined in this Bug's Decription
on both Firefox 92.0 (the version shipped with the O/S) and the latest
Google Chrome 96.0.4664.45 (official build, downloaded from [1]). I attach
two new screnshots from the OPAC, illustrating the problem with the
disappearing "Highlight"/"Unhighlight" button.

[1] https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Comment 6 Andreas Roussos 2021-11-29 11:42:31 UTC Comment hidden (obsolete)
Comment 7 Andreas Roussos 2021-11-29 11:42:46 UTC Comment hidden (obsolete)
Comment 8 Thibaud Guillot 2021-12-02 10:48:18 UTC Comment hidden (obsolete)
Comment 9 David Nind 2021-12-08 05:43:37 UTC
Hi Andreas and Thibaud.

From your screenshots I can see that what is described is happening, but I still can't reproduce it.

I was testing on the latest master with Zebra koha-testing-docker.

Are there any specific system preferences that need to be set, or any other configuration that needs to be done?

David
Comment 10 Andreas Roussos 2021-12-17 10:00:00 UTC
(In reply to David Nind from comment #9)
> Hi Andreas and Thibaud.
> 
> From your screenshots I can see that what is described is happening, but I
> still can't reproduce it.
> 
> I was testing on the latest master with Zebra koha-testing-docker.
> 
> Are there any specific system preferences that need to be set, or any other
> configuration that needs to be done?
> 
> David
Hi David,

Thank you for your continued interest in this bug report! ;-)

The Koha instance I used was brand new, without any specific system
preferences applied to it (I actually double-checked this today via the
Log viewer under Tools which showed no SysPref modifications at all).
It's a generic MARC21 instance w/ Zebra, nothing special about it AFAICT.

This is a long shot, but could it be that -- somehow -- the patch is
already applied to your docker instance when you launch it, therefore
you are always seeing the correct behaviour w.r.t. the highlighter?
Comment 11 Katrin Fischer 2022-02-26 23:14:32 UTC
1) Replicating the problem

I am sorry to say, but I can't replicate the error exactly as described:

The buttons don't disappear.

But I see a small improvement with the patch:
	
Συλλογής των εν επιτομή τοῖς πάλαι γεωγραφηθέντων

First it only highlighted the last 2 letters, but not the τ. With the patch applied and after some nudging to load the new libary των is highlighted completely.

I tested in latest Ubuntu with Firefox and Chrome.

2) Updating plugin

I think if we update the plugin, we will also want to change the version coded in the file name, so we force browsers to load the updated file:

koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js

Also, your change is only for the OPAC, we probably need to update in the staff interface separately.

Adding Owen for some advice here.
Comment 13 Katrin Fischer 2022-02-27 00:15:25 UTC
Sorry, bug number confusion on my part...
Comment 14 Thibaud Guillot 2022-12-23 14:23:06 UTC
(In reply to David Nind from comment #9)
> Hi Andreas and Thibaud.
> 
> From your screenshots I can see that what is described is happening, but I
> still can't reproduce it.
> 
> I was testing on the latest master with Zebra koha-testing-docker.
> 
> Are there any specific system preferences that need to be set, or any other
> configuration that needs to be done?
> 
> David

Hello David,

Did you try this patch recently ? 

Last attachment pushed can fix this behavior so I will change this bug to Needs SO to try to move forward :)
Comment 15 Amaury GAU 2023-01-25 18:02:27 UTC
Hi,

I can't reproduce the Test Plan. Everything seems correct before and after applying the patch, in both the Staff interface and the OPAC. 

This might have been corrected throughout the updates. Probably needs some checkup.
Comment 16 Thibaud Guillot 2023-02-01 09:39:54 UTC
(In reply to Amaury GAU from comment #15)
> Hi,
> 
> I can't reproduce the Test Plan. Everything seems correct before and after
> applying the patch, in both the Staff interface and the OPAC. 
> 
> This might have been corrected throughout the updates. Probably needs some
> checkup.

Hi Amaury,

I tried to reproduce it again, there are some behavior changes on the master, the button to highlight or not appears now but the terms are not properly highlighted (as in the test plan: "b) not all search terms are highlighted (e.g. "των" in the 2nd book)") and after applying this patch it seems to be fixed.

However, for versions 21.11 and earlier, the behavior is as explained in this bug.
Comment 17 Thibaud Guillot 2023-02-01 09:42:42 UTC
(In reply to Amaury GAU from comment #15)
> Hi,
> 
> I can't reproduce the Test Plan. Everything seems correct before and after
> applying the patch, in both the Staff interface and the OPAC. 
> 
> This might have been corrected throughout the updates. Probably needs some
> checkup.

I forgot to answer you about sysprefs or others that must be activated.. 
On master now there is a syspref to activate Highlight on search terms, so it must be set on 'Highlight' of course => see "StaffHighlightedWords".

Thanks :)
Comment 18 Fridolin Somers 2023-02-17 18:20:45 UTC
Hi,

We need to rename jquery.highlight-3.js => jquery.highlight-5.js no ?
Comment 19 Andreas Roussos 2023-02-21 20:20:48 UTC
Thank you all for your valuable feedback! Please see my answers below:

(In reply to Katrin Fischer from comment #11)
> I think if we update the plugin, we will also want to change the version
> coded in the file name, so we force browsers to load the updated file:
Done. I will attach an updated patch that renames the plugin.

> Also, your change is only for the OPAC, we probably need to update in the
> staff interface separately.
Actually, my first patch took care of both. See here:
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128053&action=diff

(In reply to Amaury GAU from comment #15)
> I can't reproduce the Test Plan. Everything seems correct before and after
> applying the patch, in both the Staff interface and the OPAC. 
Indeed, when I try the test plan on the current master (commit
9863c18cc8) I get what Katrin observed in Comment 11. However,
if I set up a UNIMARC test instance on master I still get the
disappearing "Highlight" button but now only in the OPAC! Also,
in both the Staff interface and the OPAC the following message
is displayed in the JavaScript Console:
Uncaught DOMException: Failed to execute 'splitText' on 'Text':
The offset 3 is larger than the Text node's length.

> This might have been corrected throughout the updates. Probably needs some
> checkup.
I will upload two more screenshots to show the highlighting
behaviour in a UNIMARC instance, and will adjust the test plan.

(In reply to Fridolin Somers from comment #18)
> We need to rename jquery.highlight-3.js => jquery.highlight-5.js no ?
Yes, we do. My updated patch will take care of this.
Comment 20 Andreas Roussos 2023-02-21 20:23:10 UTC
Created attachment 147088 [details]
OPAC highlight button disappearing (UNIMARC instance on current master)
Comment 21 Andreas Roussos 2023-02-21 20:24:12 UTC
Created attachment 147089 [details]
Staff interface term highlighting partially broken (UNIMARC instance on current master)
Comment 22 Andreas Roussos 2023-02-21 20:26:35 UTC
Created attachment 147090 [details] [review]
Bug 29578: Upgrade the jQuery highlighter plugin

Under certain conditions, the jQuery term highlighter
can break and in the process make the "Highlight" /
"Unhighlight" button disappear altogether. This affects
catalog searches in both the OPAC and the Staff Client,
with UNIMARC-based instances affected the most as the
"Highlight" / "Unhighlight" button disappears if you
perform a specific OPAC search (see Test plan below).

This patch fixes that by upgrading the highlighter
plugin to its latest version for both the OPAC and
the Staff interface. Then, the changes from commit
2e4b574074 (Bug 5844) are applied to the plugin code.
Also, Koha uses "term" instead of "highlight" as the
class name for the <span> highlighting elements, so
the plugin code is modified for that aspect, too.
Finally, the plugin file is renamed to reflect the
version change (v3 -> v5) and all references to the
old filename in the Template files are updated.

Test plan:

0) In a UNIMARC instance, catalogue two books using
   the titles given below (Title subfield = 200$a):

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

1) OpacHighlightedWords and StaffHighlightedWords
   should both be set to "Highlight".

2) Search the OPAC for "επιτομή των" (without the
   quotes). In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) the "Highlight" / "Unhighlight" button vanishes
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

3) Repeat the same search in the Staff interface.
   In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) Even though some terms are highlighted, the
      button still says "Highlight"
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

4) Apply this patch.

5) Repeat the searches (you may have to press CTRL-F5
   to reload the JavaScript code). This time the
   "Highlight" / "Unhighlight" button is displayed
   in the OPAC, and all your search terms should be
   highlighted in yellow. Toggling the highlight
   should cause no problems, and there shouldn't be
   any errors logged in your browser's Console.
Comment 23 Stephanie Etallaz 2023-06-30 13:32:55 UTC
CONFLICT (rename/rename): Rename "koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js"->"koha-tmpl/opac-tmpl/lib/jquery/plugins/jquery.highlight-3.js" in branch "HEAD" rename "koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js"->"koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-5.js" in "Bug 29578: Upgrade the jQuery highlighter plugin"
Comment 24 Andreas Roussos 2023-08-02 01:32:10 UTC
Created attachment 154146 [details] [review]
Bug 29578: Upgrade the jQuery highlighter plugin

Under certain conditions, the jQuery term highlighter
can break and in the process make the "Highlight" /
"Unhighlight" button disappear altogether. This affects
catalog searches in both the OPAC and the Staff Client,
with UNIMARC-based instances affected the most as the
"Highlight" / "Unhighlight" button disappears if you
perform a specific OPAC search (see Test plan below).

This patch fixes that by upgrading the highlighter
plugin to its latest version for both the OPAC and
the Staff interface. Then, the changes from commit
2e4b574074 (Bug 5844) are applied to the plugin code.
Also, Koha uses "term" instead of "highlight" as the
class name for the <span> highlighting elements, so
the plugin code is modified for that aspect, too.
Finally, the plugin file is renamed to reflect the
version change (v3 -> v5) and all references to the
old filename in the Template files are updated.

Test plan:

0) In a UNIMARC instance, catalogue two books using
   the titles given below (Title subfield = 200$a):

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

1) OpacHighlightedWords and StaffHighlightedWords
   should both be set to "Highlight".

2) Search the OPAC for "επιτομή των" (without the
   quotes). In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) the "Highlight" / "Unhighlight" button vanishes
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

3) Repeat the same search in the Staff interface.
   In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) Even though some terms are highlighted, the
      button still says "Highlight"
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

4) Apply this patch.

5) Repeat the searches (you may have to press CTRL-F5
   to reload the JavaScript code). This time the
   "Highlight" / "Unhighlight" button is displayed
   in the OPAC, and all your search terms should be
   highlighted in yellow. Toggling the highlight
   should cause no problems, and there shouldn't be
   any errors logged in your browser's Console.
Comment 25 Andreas Roussos 2023-08-02 01:36:36 UTC
(In reply to Stephanie Etallaz from comment #23)
> CONFLICT (rename/rename): Rename
> "koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js"-
> >"koha-tmpl/opac-tmpl/lib/jquery/plugins/jquery.highlight-3.js" in branch
> "HEAD" rename
> "koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-3.js"-
> >"koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.highlight-5.js" in
> "Bug 29578: Upgrade the jQuery highlighter plugin"
Thank you for your interest in this bug report, Stephanie.

The patch has been rebased against the current master, please try again ;-)
Comment 26 Biblibre Sandboxes 2023-08-17 08:09:05 UTC
Created attachment 154494 [details] [review]
Bug 29578: Upgrade the jQuery highlighter plugin

Under certain conditions, the jQuery term highlighter
can break and in the process make the "Highlight" /
"Unhighlight" button disappear altogether. This affects
catalog searches in both the OPAC and the Staff Client,
with UNIMARC-based instances affected the most as the
"Highlight" / "Unhighlight" button disappears if you
perform a specific OPAC search (see Test plan below).

This patch fixes that by upgrading the highlighter
plugin to its latest version for both the OPAC and
the Staff interface. Then, the changes from commit
2e4b574074 (Bug 5844) are applied to the plugin code.
Also, Koha uses "term" instead of "highlight" as the
class name for the <span> highlighting elements, so
the plugin code is modified for that aspect, too.
Finally, the plugin file is renamed to reflect the
version change (v3 -> v5) and all references to the
old filename in the Template files are updated.

Test plan:

0) In a UNIMARC instance, catalogue two books using
   the titles given below (Title subfield = 200$a):

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

1) OpacHighlightedWords and StaffHighlightedWords
   should both be set to "Highlight".

2) Search the OPAC for "επιτομή των" (without the
   quotes). In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) the "Highlight" / "Unhighlight" button vanishes
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

3) Repeat the same search in the Staff interface.
   In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) Even though some terms are highlighted, the
      button still says "Highlight"
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

4) Apply this patch.

5) Repeat the searches (you may have to press CTRL-F5
   to reload the JavaScript code). This time the
   "Highlight" / "Unhighlight" button is displayed
   in the OPAC, and all your search terms should be
   highlighted in yellow. Toggling the highlight
   should cause no problems, and there shouldn't be
   any errors logged in your browser's Console.

Signed-off-by: Christian Nelson <christian.nelson@uwasa.fi>
Comment 27 David Nind 2023-08-17 17:27:08 UTC
Hi Christian.

Since you've signed off the bug, you should change the status in Bugzilla to 'Signed Off'.

That way you will get the credit in the dashboard! (https://dashboard.koha-community.org/)

David
Comment 28 Christian Nelson 2023-08-18 07:15:52 UTC
Thank you David. Now the status should be updated. Training sign-off in Perl KohaCon in Helsinki :)
Comment 29 David Nind 2023-08-18 08:58:36 UTC
That's great!
Comment 30 Katrin Fischer 2023-08-25 12:17:03 UTC
Created attachment 154807 [details] [review]
Bug 29578: Upgrade the jQuery highlighter plugin

Under certain conditions, the jQuery term highlighter
can break and in the process make the "Highlight" /
"Unhighlight" button disappear altogether. This affects
catalog searches in both the OPAC and the Staff Client,
with UNIMARC-based instances affected the most as the
"Highlight" / "Unhighlight" button disappears if you
perform a specific OPAC search (see Test plan below).

This patch fixes that by upgrading the highlighter
plugin to its latest version for both the OPAC and
the Staff interface. Then, the changes from commit
2e4b574074 (Bug 5844) are applied to the plugin code.
Also, Koha uses "term" instead of "highlight" as the
class name for the <span> highlighting elements, so
the plugin code is modified for that aspect, too.
Finally, the plugin file is renamed to reflect the
version change (v3 -> v5) and all references to the
old filename in the Template files are updated.

Test plan:

0) In a UNIMARC instance, catalogue two books using
   the titles given below (Title subfield = 200$a):

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

1) OpacHighlightedWords and StaffHighlightedWords
   should both be set to "Highlight".

2) Search the OPAC for "επιτομή των" (without the
   quotes). In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) the "Highlight" / "Unhighlight" button vanishes
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

3) Repeat the same search in the Staff interface.
   In the results page, notice that:

   a) You get an Uncaught DOMException error in the
      web browswer's JavaScript Console (press F12):
      "Failed to execute 'splitText' on 'Text': The
      offset 3 is larger than the Text node's length."
   b) Even though some terms are highlighted, the
      button still says "Highlight"
   c) some search terms matches are not highlighted
      (for example "των" in the 2nd Book)

4) Apply this patch.

5) Repeat the searches (you may have to press CTRL-F5
   to reload the JavaScript code). This time the
   "Highlight" / "Unhighlight" button is displayed
   in the OPAC, and all your search terms should be
   highlighted in yellow. Toggling the highlight
   should cause no problems, and there shouldn't be
   any errors logged in your browser's Console.

Signed-off-by: Christian Nelson <christian.nelson@uwasa.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 31 Tomás Cohen Arazi 2023-08-29 17:36:06 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 32 Fridolin Somers 2023-08-30 06:36:04 UTC
Pushed to 23.05.x for 23.05.04
Comment 33 Matt Blenkinsop 2023-08-31 10:12:05 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x