NoZebra : removing . and : before indexing
authorPaul POULAIN <paul.poulain@biblibre.com>
Tue, 19 Feb 2008 17:55:22 +0000 (06:55 +1300)
committerJoshua Ferraro <jmf@liblime.com>
Wed, 20 Feb 2008 02:27:36 +0000 (20:27 -0600)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Biblio.pm
C4/Search.pm
misc/migration_tools/rebuild_nozebra.pl

index 0340b81..86f6310 100755 (executable)
@@ -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
index 080d13a..12ee865 100644 (file)
@@ -1805,7 +1805,7 @@ sub NZoperatorAND{
                 "$value-$countvalue;$value-$countvalue;";
         }
     }
-    warn " $finalresult \n" if $DEBUG;
+    warn "NZAND DONE : $finalresult \n" if $DEBUG;
     return $finalresult;
 }
       
index a1191af..114d87f 100755 (executable)
@@ -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";