diff --git a/C4/Search.pm b/C4/Search.pm index a108525db2..a82e8c292a 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1052,19 +1052,28 @@ sub searchResults { } # add spans to search term in results for search term highlighting # save a native author, for the > link + my $searchhighlightblob; + for my $highlight_field ($marcrecord->fields) { + next if $highlight_field->tag() =~ /(^00)/; # skip fixed fields + my $match; + my $field = $highlight_field->as_string(); + for my $term ( keys %$span_terms_hashref ) { + if (($field =~ /$term/) && (length($term) > 3)) { + $field =~ s/$term/$&<\/span>/gi; + $match++; + } + } + $searchhighlightblob .= $field." ... " if $match; + } + $oldbiblio->{'searchhighlightblob'} = $searchhighlightblob; + $oldbiblio->{'author_nospan'} = $oldbiblio->{'author'}; - foreach my $term ( keys %$span_terms_hashref ) { + for my $term ( keys %$span_terms_hashref ) { my $old_term = $term; if ( length($term) > 3 ) { - $term =~ s/(.*=|\)|\(|\+|\.|\?|\[|\])//g; - $term =~ s/\\//g; - $term =~ s/\*//g; - - #FIXME: is there a better way to do this? + $term =~ s/(.*=|\)|\(|\+|\.|\?|\[|\]|\\|\*)//g; $oldbiblio->{'title'} =~ s/$term/$&<\/span>/gi; - $oldbiblio->{'subtitle'} =~ - 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; 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 85b01c5759..311e8a6f60 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl @@ -290,6 +290,7 @@ $(window).load(function() { (modified on )
+ No holds allowed