Bugzilla – Attachment 4597 Details for
Bug 6566
Checking if DB records are properly indexed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
new proposed patch
0001-Bug-6566-Checking-if-DB-s-records-are-properly-index.patch (text/plain), 2.76 KB, created by
Christophe Croullebois
on 2011-07-08 10:09:21 UTC
(
hide
)
Description:
new proposed patch
Filename:
MIME Type:
Creator:
Christophe Croullebois
Created:
2011-07-08 10:09:21 UTC
Size:
2.76 KB
patch
obsolete
>From ca86caf3ae6330604ed2f86553456511bdf798ee Mon Sep 17 00:00:00 2001 >From: Christophe Croullebois <christophe.croullebois@biblibre.com> >Date: Fri, 8 Jul 2011 11:52:53 +0200 >Subject: [PATCH 1/1] Bug 6566 Checking if DB's records are properly indexed > >Small script that checks that each biblio in the DB is properly indexed >(MT #6389) >--- > misc/migration_tools/checkNonIndexedBiblios.pl | 69 ++++++++++++++++++++++++ > 1 files changed, 69 insertions(+), 0 deletions(-) > create mode 100755 misc/migration_tools/checkNonIndexedBiblios.pl > >diff --git a/misc/migration_tools/checkNonIndexedBiblios.pl b/misc/migration_tools/checkNonIndexedBiblios.pl >new file mode 100755 >index 0000000..7bfede5 >--- /dev/null >+++ b/misc/migration_tools/checkNonIndexedBiblios.pl >@@ -0,0 +1,69 @@ >+#!/usr/bin/perl >+# Small script that checks that each biblio in the DB is properly indexed >+ >+use strict; >+ >+use warnings; >+ >+BEGIN { >+ >+ # find Koha's Perl modules >+ # test carefully before changing this >+ use FindBin; >+ eval { require "$FindBin::Bin/kohalib.pl" }; >+} >+ >+# Koha modules used >+use MARC::Record; >+use C4::Context; >+use C4::Search; >+use Time::HiRes qw(gettimeofday); >+ >+use Getopt::Long; >+my ( $input_marc_file, $number ) = ( '', 0 ); >+my ( $version, $confirm, $zebraqueue, $silent ); >+GetOptions( >+ 'c' => \$confirm, >+ 'h' => \$version, >+ 'z' => \$zebraqueue, >+ 's' => \$silent >+); >+ >+if ( $version || ( !$confirm ) ) { >+ print <<EOF >+This script takes all biblios and check they are indexed in zebra using biblionumber search. >+ >+parameters: >+\th this help screen >+\tc confirm (without this parameter, you get the help screen >+\tz insert a signal in zebraqueue to force indexing of non indexed biblios >+\ts silent throw no warnings except for non indexed records. Otherwise throw a warn every 1000 biblios to show progress >+ >+Syntax: >+\t./batchCheckNonIndexedBiblios.pl -h (or without arguments => shows this screen) >+\t./batchCheckNonIndexedBiblios.pl -c (c like confirm => check all records (may be long) >+\t-t => test only, change nothing in DB >+EOF >+ ; >+ exit; >+} >+ >+my $dbh = C4::Context->dbh; >+my $i = 0; >+my $starttime = time(); >+ >+$| = 1; # flushes output >+$starttime = gettimeofday; >+ >+my $sth = $dbh->prepare("SELECT biblionumber FROM biblio"); >+my $sth_insert = $dbh->prepare("INSERT INTO zebraqueue (biblio_auth_number,operation,server,done) VALUES (?,'specialUpdate','biblioserver',0)"); >+$sth->execute; >+my ($nbhits); >+while ( my ($biblionumber) = $sth->fetchrow ) { >+ (undef,undef,$nbhits) = SimpleSearch("Local-number=$biblionumber"); >+ print "biblionumber $biblionumber not indexed\n" unless $nbhits; >+ $sth_insert->execute($biblionumber) if $zebraqueue and !$nbhits; >+ $i++; >+ print "$i done\n" unless $i % 1000; >+} >+ >-- >1.7.0.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6566
:
4597
|
10417
|
10535
|
10541