Bug 7246 add offset/length and where options to rebuild_zebra
This patch reimplement a feature that is on biblibre/master for Koha-community/master It adds 4 parameters: * offset = the offset of record. Say 1000 to start rebuilding at the 1000th record of your database * length = how many records to export. Say 400 to export only 400 records * where = add a where clause to rebuild only a given itemtype, or anything you want to filter on Another improvement resulting from offset & length limit is the rebuild_zebra_sliced.zsh that will be submitted in another patch. rebuild_zebra_sliced will slice your all database in small chunks, and, if something went wrong for a given slice, will slice the slice, and repeat, until you reach a slice size of 1, showing which record is wrong in your database. Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> Removed mention of -l option for limiting number of items exported, as requested by QA manager. This can be re-added in a later patch. Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
parent
647843c3bb
commit
1fd8c8a4de
1 changed files with 25 additions and 4 deletions
|
@ -34,6 +34,9 @@ my $want_help;
|
|||
my $as_xml;
|
||||
my $process_zebraqueue;
|
||||
my $do_not_clear_zebraqueue;
|
||||
my $length;
|
||||
my $where;
|
||||
my $offset;
|
||||
my $verbose_logging = 0;
|
||||
my $zebraidx_log_opt = " -v none,fatal,warn ";
|
||||
my $result = GetOptions(
|
||||
|
@ -51,7 +54,10 @@ my $result = GetOptions(
|
|||
'x' => \$as_xml,
|
||||
'y' => \$do_not_clear_zebraqueue,
|
||||
'z' => \$process_zebraqueue,
|
||||
'v+' => \$verbose_logging,
|
||||
'where:s' => \$where,
|
||||
'length:i' => \$length,
|
||||
'offset:i' => \$offset,
|
||||
'v+' => \$verbose_logging,
|
||||
);
|
||||
|
||||
|
||||
|
@ -294,13 +300,21 @@ sub select_all_records {
|
|||
}
|
||||
|
||||
sub select_all_authorities {
|
||||
my $sth = $dbh->prepare("SELECT authid FROM auth_header");
|
||||
my $strsth=qq{SELECT authid FROM auth_header};
|
||||
$strsth.=qq{ WHERE $where } if ($where);
|
||||
$strsth.=qq{ LIMIT $length } if ($length && !$offset);
|
||||
$strsth.=qq{ LIMIT $offset,$length } if ($length && $offset);
|
||||
my $sth = $dbh->prepare($strsth);
|
||||
$sth->execute();
|
||||
return $sth;
|
||||
}
|
||||
|
||||
sub select_all_biblios {
|
||||
my $sth = $dbh->prepare("SELECT biblionumber FROM biblioitems ORDER BY biblionumber");
|
||||
my $strsth = qq{ SELECT biblionumber FROM biblioitems };
|
||||
$strsth.=qq{ WHERE $where } if ($where);
|
||||
$strsth.=qq{ LIMIT $length } if ($length && !$offset);
|
||||
$strsth.=qq{ LIMIT $offset,$length } if ($offset);
|
||||
my $sth = $dbh->prepare($strsth);
|
||||
$sth->execute();
|
||||
return $sth;
|
||||
}
|
||||
|
@ -639,7 +653,14 @@ Parameters:
|
|||
warnings and errors from the indexing are shown.
|
||||
Use log level 2 (-v -v) to include all Zebra logs.
|
||||
|
||||
-munge-config Deprecated option to try
|
||||
--length 1234 how many biblio you want to export
|
||||
--offset 1243 offset you want to start to
|
||||
example: --offset 500 --length=500 will result in a LIMIT 500,1000 (exporting 1000 records, starting by the 500th one)
|
||||
note that the numbers are NOT related to biblionumber, that's the intended behaviour.
|
||||
--where let you specify a WHERE query, like itemtype='BOOK'
|
||||
or something like that
|
||||
|
||||
--munge-config Deprecated option to try
|
||||
to fix Zebra config files.
|
||||
--help or -h show this message.
|
||||
_USAGE_
|
||||
|
|
Loading…
Reference in a new issue