Bug 10686: Remove fields from searches for highlighting
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Tue, 6 Aug 2013 00:56:48 +0000 (20:56 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 16 Aug 2013 16:33:36 +0000 (16:33 +0000)
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 <mirko@abunchofthings.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt

index 9226dec..6f45872 100644 (file)
@@ -58,6 +58,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]);
index d6b4c11..141a733 100644 (file)
@@ -83,6 +83,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();
index 0df0322..e1ef451 100644 (file)
@@ -98,6 +98,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]);