From 0e2b06521971e095e50db8bc7ae58ccd828b4d86 Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Wed, 20 Feb 2008 06:55:22 +1300 Subject: [PATCH] NoZebra : removing . and : before indexing Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 2 +- C4/Search.pm | 2 +- misc/migration_tools/rebuild_nozebra.pl | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 0340b81149..86f6310379 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2269,7 +2269,7 @@ sub _AddBiblioNoZebra { } # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values - $title =~ s/ |,|;|\[|\]|\(|\)|\*|-|'|=//g; + $title =~ s/ |\.|,|;|\[|\]|\(|\)|\*|-|'|:|=//g; # limit to 10 char, should be enough, and limit the DB size $title = substr($title,0,10); #parse each field diff --git a/C4/Search.pm b/C4/Search.pm index 080d13a209..12ee86511c 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1805,7 +1805,7 @@ sub NZoperatorAND{ "$value-$countvalue;$value-$countvalue;"; } } - warn " $finalresult \n" if $DEBUG; + warn "NZAND DONE : $finalresult \n" if $DEBUG; return $finalresult; } diff --git a/misc/migration_tools/rebuild_nozebra.pl b/misc/migration_tools/rebuild_nozebra.pl index a1191af9e6..114d87fe26 100755 --- a/misc/migration_tools/rebuild_nozebra.pl +++ b/misc/migration_tools/rebuild_nozebra.pl @@ -108,7 +108,7 @@ while (my ($biblionumber) = $sth->fetchrow) { my $title = lc($record->subfield($titletag,$titlesubfield)); # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values - $title =~ s/ |,|;|\[|\]|\(|\)|\*|-|'|=//g; + $title =~ s/ |\.|,|;|\[|\]|\(|\)|\*|-|'|=|://g; # limit to 10 char, should be enough, and limit the DB size $title = substr($title,0,10); #parse each field @@ -214,7 +214,7 @@ while (my ($authid) = $sth->fetchrow) { $index{'auth_type'} = '152b'; # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values - $title =~ s/ |,|;|\[|\]|\(|\)|\*|-|'|=//g; + $title =~ s/ |\.|,|;|\[|\]|\(|\)|\*|-|'|:|=//g; $title = quotemeta $title; # limit to 10 char, should be enough, and limit the DB size $title = substr($title,0,10); @@ -271,6 +271,9 @@ while (my ($authid) = $sth->fetchrow) { } print "\nInserting...\n"; $i=0; + +my $commitnum = 100; +$dbh->{AutoCommit} = 0; $sth = $dbh->prepare("INSERT INTO nozebra (server,indexname,value,biblionumbers) VALUES ('authorityserver',?,?,?)"); foreach my $key (keys %result) { foreach my $index (keys %{$result{$key}}) { @@ -280,6 +283,7 @@ foreach my $key (keys %result) { print "\r$i"; $i++; $sth->execute($key,$index,$result{$key}->{$index}); + $dbh->commit() if (0 == $i % $commitnum); } } print "\nauthorities done\n"; -- 2.39.5