From 23bb4bcb002ef0c79979597a33c1de9ffdf46eab Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Mon, 5 Aug 2013 20:56:48 -0400 Subject: [PATCH] Bug 10686: Remove fields from searches for highlighting If you do a fielded search like au:smith, "Smith" will not get highlighted on the results page because the Javascript is looking for the exact string "au:smith." To test: 1) Turn on OpacHighlightedWords. 2) Do a simple keyword search. 3) Confirm that the word is highlighted on the results and details page. 4) Do a fielded search by entering au:smith (or whatever). 5) Confirm that the word is highlighted on the results and details page. 6) Sign off. Signed-off-by: Mirko Tietgen Signed-off-by: Kyle M Hall Passes koha-qa.pl, works as advertised. Signed-off-by: Galen Charlton (cherry picked from commit b0ea3be36c8e7ae6dc6f28820b1c26fc909d9039) Signed-off-by: Tomas Cohen Arazi (cherry picked from commit a85f9e1928a89e5c8f01983f1b853b090ec8cd1e) Signed-off-by: Bernardo Gonzalez Kriegel (cherry picked from commit a85f9e1928a89e5c8f01983f1b853b090ec8cd1e) --- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt | 1 + 3 files changed, 3 insertions(+) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 8b38b8f127..080d865b05 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -39,6 +39,7 @@ function highlightOn() { var x; for (x in q_array) { + q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1"); $(".title").highlight(q_array[x]); $(".author").highlight(q_array[x]); $(".results_summary").highlight(q_array[x]); diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt index 44fd575d09..430985b1bb 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt @@ -82,6 +82,7 @@ function highlightOff() { function highlightOn() { var x; for (x in q_array) { + q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1"); $("td").highlight(q_array[x]); } $(".highlight_toggle").toggle(); diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt index 75df15d58d..78a465e5ae 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -95,6 +95,7 @@ function highlightOff() { function highlightOn() { var x; for (x in q_array) { + q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1"); if ( q_array[x].length > 0 ) { $(".title").highlight(q_array[x]); $(".author").highlight(q_array[x]); -- 2.39.5