Bugzilla – Attachment 20240 Details for
Bug 6149
Operator Highlighted in Search Results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to add syspref controlled stopwords to highlighting.
0001-Bug-6149-Stopwords-for-Result-Highlighting.patch (text/plain), 4.79 KB, created by
Martin Renvoize (ashimema)
on 2013-08-09 16:09:19 UTC
(
hide
)
Description:
Patch to add syspref controlled stopwords to highlighting.
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2013-08-09 16:09:19 UTC
Size:
4.79 KB
patch
obsolete
>From 6e405f9537a3b3f704b67532cdf85f60e985c8b4 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 9 Aug 2013 14:42:00 +0100 >Subject: [PATCH] Bug 6149 - Stopwords for Result Highlighting > >This patch adds a system preference to control stopwords used to >prevent operators and other 'minor' words from being highlighted >in search results when the OpacHighlightWords syspref is enabled >--- > .../prog/en/modules/admin/preferences/opac.pref | 5 ++++- > koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 11 +++++++---- > koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt | 13 ++++++++----- > opac/opac-detail.pl | 1 + > opac/opac-search.pl | 5 +++++ > 5 files changed, 25 insertions(+), 10 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 90295ef..cb70b2c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -135,7 +135,10 @@ OPAC: > choices: > yes: Highlight > no: "Don't highlight" >- - words the patron searched for in their search results and detail pages. >+ - words the patron searched for in their search results and detail pages; To prevent certain words from ever being highlighted, enter a list of stopwords here >+ - pref: OpacHighlightedStopWords >+ class: multi >+ - (separate columns with |) > - > - pref: AuthorisedValueImages > choices: >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 9226dec..95201a0 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -57,10 +57,13 @@ > } > function highlightOn() { > var x; >- for (x in q_array) { >- $(".title").highlight(q_array[x]); >- $(".author").highlight(q_array[x]); >- $(".results_summary").highlight(q_array[x]); >+ for (x in q_array) { >+ var myStopwords = "[% OpacHighlightedStopWords %]".split('|'); >+ if( $.inArray(q_array[x], myStopwords) == -1 ) { >+ $(".title").highlight(q_array[x]); >+ $(".author").highlight(q_array[x]); >+ $(".results_summary").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 0df0322..2ad8a95 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >@@ -98,11 +98,14 @@ function highlightOff() { > function highlightOn() { > var x; > for (x in q_array) { >- if ( q_array[x].length > 0 ) { >- $(".title").highlight(q_array[x]); >- $(".author").highlight(q_array[x]); >- $(".results_summary").highlight(q_array[x]); >- } >+ for (x in q_array) { >+ var myStopwords = "[% OpacHighlightedStopWords %]".split('|'); >+ if( $.inArray(q_array[x], myStopwords) == -1 ) { >+ $(".title").highlight(q_array[x]); >+ $(".author").highlight(q_array[x]); >+ $(".results_summary").highlight(q_array[x]); >+ } >+ } > } > $(".highlight_toggle").toggle(); > } >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 9d0851f..ed5513e 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -1053,6 +1053,7 @@ $template->{VARS}->{OPACPopupAuthorsSearch} = C4::Context->preference('OPACPopup > > if (C4::Context->preference('OpacHighlightedWords')) { > $template->{VARS}->{query_desc} = $query->param('query_desc'); >+ $template->{VARS}->{OpacHighlightedStopWords} = C4::Context->preference('OpacHighlightedStopWords'); > } > $template->{VARS}->{'trackclicks'} = C4::Context->preference('TrackClicks'); > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 7d2b7a6..4275149 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -616,6 +616,11 @@ for (my $i=0;$i<@servers;$i++) { > $total = $total + $results_hashref->{$server}->{"hits"}; > } > >+ # Add Stopwrods for query highlighting >+ if (C4::Context->preference('OpacHighlightedWords')) { >+ $template->{VARS}->{OpacHighlightedStopWords} = C4::Context->preference('OpacHighlightedStopWords'); >+ } >+ > # Opac search history > my $newsearchcookie; > if (C4::Context->preference('EnableOpacSearchHistory')) { >-- >1.8.1.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6149
:
20240
|
20469
|
20540
|
20543
|
20715
|
20802
|
21168
|
21582
|
21831
|
22448
|
22463
|
22466
|
22505
|
22511
|
23005
|
23025
|
23027
|
23064
|
23065
|
23066
|
26051
|
30136
|
30137
|
30138
|
30139
|
30140
|
30141
|
30142
|
30143
|
30144
|
30835
|
30842
|
30843
|
30844
|
30845
|
30846
|
31403