If you search in the staff client for the keyword apple, you can then unhighlight and hightlight again over and over without harm, but if you search for the keyword apple apple (or any other repeated word, the search that showed it to me was the word A in A giraffe and a half), when you click unhighlight the first instance of the repeated word is completely removed from each search result, and if you click highlight, and then click unhighlight again, the next instance will be removed each time you highlight/unhighlight.
Confirmed, also appears to be limited to staff, OPAC is ok.
I cannot reproduce this problem in master. Can anyone confirm? If so please cite another example.
Still present in master. How about the example from bug 5844, which fixed the copy of jquery.highlight-3.js in koha-tmpl/opac-tmpl/ but not the copy in koha-tmpl/intranet-tmpl/, "mag ma m"? All that's actually needed is to patch the intranet-tmpl copy the same way. I don't quite see how an example can actually work, unless there's some standard set of bib records everyone has that I haven't yet run across documentation of, though. Before I realized why it only happens in the staff client, I was drafting a set of steps to reproduce that were going to start with "Create a bib record with the title A is for apple and another with the title A my name is Anna" since reproducing requires only that you have a search which in your database will return two or more records and will have matches in things which are displayed in the staff client search results list. "a a" is actually a pretty good example since as long as you have two (or more) records in your database which contain the letter "a" in any indexed field, you will have highlights that will show the letter being removed from the DOM in the words "Material" and "Format" and "Literary" in the line "Material type: Book Format: print Literary form: Not fiction" even if you don't have highlights in the author or title. Might still fail for a non-English install, but otherwise it seems like the most likely to work in any install with any bib records.
I can reproduce this: I searched for "the the". Unhighlighting removes the first occurrence of the word in the result list. (intranet only) From the sample data: The ideas behind the chess openings / Reuben Fine. Turns into: ideas behind the chess openings / Reuben Fine.
Created attachment 103210 [details] [review] Bug 20501: Don't cut strings when unhighlighting in intranet search results When you click Unhighlight on the search results of a search in the staff client when the search terms contain the same word twice, like "ma ma", the highlighted words disappear, and don't reappear if you click Highlight. This patch makes the same change to the intranet copy of jquery.highlight-3.js that bug 5844 made to the OPAC copy. Test plan: 1) Without this patch, search in the intranet for ma ma and verify you have at least two matching records. 2) Notice that the Ma in Material type: Book is highlighted. 3) Click Unhighlight, and notice that it has become terial type: Book 4) Apply this patch, repeat the search with a shift+reload to reload the .js 5) Click Unhighlight, and verify that Material type: Book remains Material
Created attachment 103319 [details] [review] Bug 20501: Don't cut strings when unhighlighting in intranet search results When you click Unhighlight on the search results of a search in the staff client when the search terms contain the same word twice, like "ma ma", the highlighted words disappear, and don't reappear if you click Highlight. This patch makes the same change to the intranet copy of jquery.highlight-3.js that bug 5844 made to the OPAC copy. Test plan: 1) Without this patch, search in the intranet for ma ma and verify you have at least two matching records. 2) Notice that the Ma in Material type: Book is highlighted. 3) Click Unhighlight, and notice that it has become terial type: Book 4) Apply this patch, repeat the search with a shift+reload to reload the .js 5) Click Unhighlight, and verify that Material type: Book remains Material Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Work as described, no errors.
Created attachment 103387 [details] [review] Bug 20501: Don't cut strings when unhighlighting in intranet search results When you click Unhighlight on the search results of a search in the staff client when the search terms contain the same word twice, like "ma ma", the highlighted words disappear, and don't reappear if you click Highlight. This patch makes the same change to the intranet copy of jquery.highlight-3.js that bug 5844 made to the OPAC copy. Test plan: 1) Without this patch, search in the intranet for ma ma and verify you have at least two matching records. 2) Notice that the Ma in Material type: Book is highlighted. 3) Click Unhighlight, and notice that it has become terial type: Book 4) Apply this patch, repeat the search with a shift+reload to reload the .js 5) Click Unhighlight, and verify that Material type: Book remains Material Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Work as described, no errors. Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Nice work everyone! Pushed to master for 20.05
Backported to 19.11.x for 19.11.06
backported to 19.05.x for 19.05.11