From a201a8bd898bb009baa54ce029ea0694e25f4e1d Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Mon, 14 Apr 2008 18:55:52 +0200 Subject: [PATCH] BUGFIX : highlighting term fixes Signed-off-by: Joshua Ferraro --- C4/Search.pm | 53 ++++++++++--------- .../prog/en/modules/catalogue/results.tmpl | 2 +- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index dc05673390..a3ffc09118 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1316,7 +1316,10 @@ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g; $oldbiblio->{summary} = $summary; } -# Add search-term highlighting to the whole record where they match using s + # save an author with no tag, for the > link + $oldbiblio->{'author_nospan'} = $oldbiblio->{'author'}; + $oldbiblio->{'title_nospan'} = $oldbiblio->{'title'}; + # Add search-term highlighting to the whole record where they match using s if (C4::Context->preference("OpacHighlightedWords")){ my $searchhighlightblob; for my $highlight_field ( $marcrecord->fields ) { @@ -1339,31 +1342,29 @@ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g; } $searchhighlightblob = ' ... '.$searchhighlightblob if $searchhighlightblob; $oldbiblio->{'searchhighlightblob'} = $searchhighlightblob; - } -# save an author with no tag, for the > link - $oldbiblio->{'author_nospan'} = $oldbiblio->{'author'}; - - # Add search-term highlighting to the title, subtitle, etc. fields - for my $term ( keys %$span_terms_hashref ) { - my $old_term = $term; - if ( length($term) > 3 ) { - $term =~ s/(.*=|\)|\(|\+|\.|\?|\[|\]|\\|\*)//g; - $oldbiblio->{'title'} =~ - s/$term/$&<\/span>/gi; - $oldbiblio->{'subtitle'} =~ - s/$term/$&<\/span>/gi; - $oldbiblio->{'author'} =~ - s/$term/$&<\/span>/gi; - $oldbiblio->{'publishercode'} =~ - s/$term/$&<\/span>/gi; - $oldbiblio->{'place'} =~ - s/$term/$&<\/span>/gi; - $oldbiblio->{'pages'} =~ - s/$term/$&<\/span>/gi; - $oldbiblio->{'notes'} =~ - s/$term/$&<\/span>/gi; - $oldbiblio->{'size'} =~ - s/$term/$&<\/span>/gi; + + # Add search-term highlighting to the title, subtitle, etc. fields + for my $term ( keys %$span_terms_hashref ) { + my $old_term = $term; + if ( length($term) > 3 ) { + $term =~ s/(.*=|\)|\(|\+|\.|\?|\[|\]|\\|\*)//g; + $oldbiblio->{'title'} =~ + s/$term/$&<\/span>/gi; + $oldbiblio->{'subtitle'} =~ + s/$term/$&<\/span>/gi; + $oldbiblio->{'author'} =~ + s/$term/$&<\/span>/gi; + $oldbiblio->{'publishercode'} =~ + s/$term/$&<\/span>/gi; + $oldbiblio->{'place'} =~ + s/$term/$&<\/span>/gi; + $oldbiblio->{'pages'} =~ + s/$term/$&<\/span>/gi; + $oldbiblio->{'notes'} =~ + s/$term/$&<\/span>/gi; + $oldbiblio->{'size'} =~ + s/$term/$&<\/span>/gi; + } } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl index 3c9b707bd7..f64f9cf999 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl @@ -152,7 +152,7 @@ $(window).load(function() { - """> + """> -- 2.39.5