[Koha-cvs] koha/C4 Search.pm [dev_week]
Joshua Ferraro
jmf at kados.org
Fri Oct 6 04:22:05 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Joshua Ferraro <kados> 06/10/06 02:22:05
Modified files:
C4 : Search.pm
Log message:
fix for bug 1178: Search term highlighting in search results breaks in some cases
problem was that it wasn't accounting for periods in the search.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Search.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.99.2.11.2.27&r2=1.99.2.11.2.28
Patches:
Index: Search.pm
===================================================================
RCS file: /sources/koha/koha/C4/Search.pm,v
retrieving revision 1.99.2.11.2.27
retrieving revision 1.99.2.11.2.28
diff -u -b -r1.99.2.11.2.27 -r1.99.2.11.2.28
--- Search.pm 4 Oct 2006 02:19:18 -0000 1.99.2.11.2.27
+++ Search.pm 6 Oct 2006 02:22:05 -0000 1.99.2.11.2.28
@@ -39,7 +39,7 @@
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.99.2.11.2.27 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.99.2.11.2.28 $' =~ /\d+/g;
shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
=head1 NAME
@@ -3224,7 +3224,11 @@
my $toggle;
my $even=1;
my @newresults;
- my @span_terms = split (/ /, $searchdesc);
+ my $span_terms_hashref;
+ for my $span_term (split (/ /, $searchdesc)) {
+ $span_term =~s/(.*=|\)|\(|\+|\.)//g;
+ $span_terms_hashref->{$span_term}++;
+ }
#Build brancnames hash
#find branchname
#get branch information.....
@@ -3262,10 +3266,11 @@
#warn "RECORD".$marcresults[$i];
my $oldbiblio = MARCmarc2koha($dbh,$marcrecord,'');
# add spans to search term in results
- foreach my $term (@span_terms) {
+ foreach my $term (keys %$span_terms_hashref) {
+ warn "term: $term";
my $old_term = $term;
if (length($term) > 3) {
- $term =~ s/(.*=|\)|\(|\+)//g;
+ $term =~ s/(.*=|\)|\(|\+|\.)//g;
#FIXME: is there a better way to do this?
$oldbiblio->{'title'} =~ s/$term/<span class=term>$&<\/span>/gi;
$oldbiblio->{'subtitle'} =~ s/$term/<span class=term>$&<\/span>/gi;
More information about the Koha-cvs
mailing list