Description
Andreas Roussos
2021-11-26 10:54:21 UTC
Created attachment 128034 [details]
search term highlighting broken in the OPAC
Created attachment 128035 [details]
search term highlighting broken in the Staff Client
Created attachment 128053 [details] [review] Bug 29578: Upgrade the jQuery highlighter plugin Under certain conditions, the jQuery term highlighter can break and in the process actually make the "Highlight"/"Unhighlight" button disappear altogether. This affects catalog searches in both the OPAC and the Staff Client. This patch fixes that by upgrading the plugin to its latest version. Test plan: 0) Catalogue two books using the titles below, one of which includes a word ("τοῖς") containing Greek diacritics: Book #1 title: Συλλογής των εν επιτομή τοῖς πάλαι γεωγραφηθέντων Book #2 title: Επιτομή της ιστορίας των Βαλκανικών Πολέμων (1912-1913) Then, perform a catalog search for "επιτομή των" (without the quotes). In the results page, notice that: a) the "Highlight"/"Unhighlight" button has disappeared, and b) not all search terms are highlighted (e.g. "των" in the 2nd book) 1) Apply this patch. 2) Repeat the same search (remember to press CTRL-F5 to refresh JS code). This time the "Highlight"/"Unhighlight" button is displayed normally, and all instances of your search terms are highlighted in the results. 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. 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 Created attachment 128067 [details]
OPAC highlight button disappearing on Ubuntu Firefox
Created attachment 128068 [details]
OPAC highlight button disappearing on Ubuntu Google Chrome
Created attachment 128150 [details] [review] Bug 29578: Upgrade the jQuery highlighter plugin Under certain conditions, the jQuery term highlighter can break and in the process actually make the "Highlight"/"Unhighlight" button disappear altogether. This affects catalog searches in both the OPAC and the Staff Client. This patch fixes that by upgrading the plugin to its latest version. Test plan: 0) Catalogue two books using the titles below, one of which includes a word ("τοῖς") containing Greek diacritics: Book #1 title: Συλλογής των εν επιτομή τοῖς πάλαι γεωγραφηθέντων Book #2 title: Επιτομή της ιστορίας των Βαλκανικών Πολέμων (1912-1913) Then, perform a catalog search for "επιτομή των" (without the quotes). In the results page, notice that: a) the "Highlight"/"Unhighlight" button has disappeared, and b) not all search terms are highlighted (e.g. "των" in the 2nd book) 1) Apply this patch. 2) Repeat the same search (remember to press CTRL-F5 to refresh JS code). This time the "Highlight"/"Unhighlight" button is displayed normally, and all instances of your search terms are highlighted in the results. Signed-off-by: ThibaudGLT <thibaud.guillot@biblibre.com> Work on Firefox 94.0-Ubuntu 20.04LTS 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 (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? 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. Sorry, bug number confusion on my part... (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 :) 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. (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. (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 :) Hi, We need to rename jquery.highlight-3.js => jquery.highlight-5.js no ? 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. Created attachment 147088 [details]
OPAC highlight button disappearing (UNIMARC instance on current master)
Created attachment 147089 [details]
Staff interface term highlighting partially broken (UNIMARC instance on current master)
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. 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" 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. (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 ;-) 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> 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 Thank you David. Now the status should be updated. Training sign-off in Perl KohaCon in Helsinki :) That's great! 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> Pushed to master for 23.11. Nice work everyone, thanks! Pushed to 23.05.x for 23.05.04 Nice work everyone! Pushed to oldstable for 22.11.x |