Lines 35-40
my $do_munge;
Link Here
|
35 |
my $want_help; |
35 |
my $want_help; |
36 |
my $as_xml; |
36 |
my $as_xml; |
37 |
my $process_zebraqueue; |
37 |
my $process_zebraqueue; |
|
|
38 |
my $process_zebraqueue_skip_deletes; |
38 |
my $do_not_clear_zebraqueue; |
39 |
my $do_not_clear_zebraqueue; |
39 |
my $length; |
40 |
my $length; |
40 |
my $where; |
41 |
my $where; |
Lines 45-70
my $run_user = (getpwuid($<))[0];
Link Here
|
45 |
my $verbose_logging = 0; |
46 |
my $verbose_logging = 0; |
46 |
my $zebraidx_log_opt = " -v none,fatal,warn "; |
47 |
my $zebraidx_log_opt = " -v none,fatal,warn "; |
47 |
my $result = GetOptions( |
48 |
my $result = GetOptions( |
48 |
'd:s' => \$directory, |
49 |
'd:s' => \$directory, |
49 |
'r|reset' => \$reset, |
50 |
'r|reset' => \$reset, |
50 |
's' => \$skip_export, |
51 |
's' => \$skip_export, |
51 |
'k' => \$keep_export, |
52 |
'k' => \$keep_export, |
52 |
'I|skip-index' => \$skip_index, |
53 |
'I|skip-index' => \$skip_index, |
53 |
'nosanitize' => \$nosanitize, |
54 |
'nosanitize' => \$nosanitize, |
54 |
'b' => \$biblios, |
55 |
'b' => \$biblios, |
55 |
'noxml' => \$noxml, |
56 |
'noxml' => \$noxml, |
56 |
'w' => \$noshadow, |
57 |
'w' => \$noshadow, |
57 |
'munge-config' => \$do_munge, |
58 |
'munge-config' => \$do_munge, |
58 |
'a' => \$authorities, |
59 |
'a' => \$authorities, |
59 |
'h|help' => \$want_help, |
60 |
'h|help' => \$want_help, |
60 |
'x' => \$as_xml, |
61 |
'x' => \$as_xml, |
61 |
'y' => \$do_not_clear_zebraqueue, |
62 |
'y' => \$do_not_clear_zebraqueue, |
62 |
'z' => \$process_zebraqueue, |
63 |
'z' => \$process_zebraqueue, |
63 |
'where:s' => \$where, |
64 |
'skip-deletes' => \$process_zebraqueue_skip_deletes, |
64 |
'length:i' => \$length, |
65 |
'where:s' => \$where, |
65 |
'offset:i' => \$offset, |
66 |
'length:i' => \$length, |
66 |
'v+' => \$verbose_logging, |
67 |
'offset:i' => \$offset, |
67 |
'run-as-root' => \$run_as_root, |
68 |
'v+' => \$verbose_logging, |
|
|
69 |
'run-as-root' => \$run_as_root, |
68 |
); |
70 |
); |
69 |
|
71 |
|
70 |
if (not $result or $want_help) { |
72 |
if (not $result or $want_help) { |
Lines 213-219
sub index_records {
Link Here
|
213 |
my ($record_type, $directory, $skip_export, $skip_index, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $server_dir) = @_; |
215 |
my ($record_type, $directory, $skip_export, $skip_index, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $server_dir) = @_; |
214 |
|
216 |
|
215 |
my $num_records_exported = 0; |
217 |
my $num_records_exported = 0; |
216 |
my $records_deleted; |
218 |
my $records_deleted = {}; |
217 |
my $need_reset = check_zebra_dirs($server_dir); |
219 |
my $need_reset = check_zebra_dirs($server_dir); |
218 |
if ($need_reset) { |
220 |
if ($need_reset) { |
219 |
print "$0: found broken zebra server directories: forcing a rebuild\n"; |
221 |
print "$0: found broken zebra server directories: forcing a rebuild\n"; |
Lines 232-246
sub index_records {
Link Here
|
232 |
mkdir "$directory" unless (-d $directory); |
234 |
mkdir "$directory" unless (-d $directory); |
233 |
mkdir "$directory/$record_type" unless (-d "$directory/$record_type"); |
235 |
mkdir "$directory/$record_type" unless (-d "$directory/$record_type"); |
234 |
if ($process_zebraqueue) { |
236 |
if ($process_zebraqueue) { |
235 |
my $entries = select_zebraqueue_records($record_type, 'deleted'); |
237 |
my $entries; |
236 |
mkdir "$directory/del_$record_type" unless (-d "$directory/del_$record_type"); |
238 |
|
237 |
$records_deleted = generate_deleted_marc_records($record_type, $entries, "$directory/del_$record_type", $as_xml); |
239 |
unless ( $process_zebraqueue_skip_deletes ) { |
238 |
mark_zebraqueue_batch_done($entries); |
240 |
$entries = select_zebraqueue_records($record_type, 'deleted'); |
|
|
241 |
mkdir "$directory/del_$record_type" unless (-d "$directory/del_$record_type"); |
242 |
$records_deleted = generate_deleted_marc_records($record_type, $entries, "$directory/del_$record_type", $as_xml); |
243 |
mark_zebraqueue_batch_done($entries); |
244 |
} |
245 |
|
239 |
$entries = select_zebraqueue_records($record_type, 'updated'); |
246 |
$entries = select_zebraqueue_records($record_type, 'updated'); |
240 |
mkdir "$directory/upd_$record_type" unless (-d "$directory/upd_$record_type"); |
247 |
mkdir "$directory/upd_$record_type" unless (-d "$directory/upd_$record_type"); |
241 |
$num_records_exported = export_marc_records_from_list($record_type, |
248 |
$num_records_exported = export_marc_records_from_list($record_type,$entries, "$directory/upd_$record_type", $as_xml, $noxml, $records_deleted); |
242 |
$entries, "$directory/upd_$record_type", $as_xml, $noxml, $records_deleted); |
|
|
243 |
mark_zebraqueue_batch_done($entries); |
249 |
mark_zebraqueue_batch_done($entries); |
|
|
250 |
|
244 |
} else { |
251 |
} else { |
245 |
my $sth = select_all_records($record_type); |
252 |
my $sth = select_all_records($record_type); |
246 |
$num_records_exported = export_marc_records_from_sth($record_type, $sth, "$directory/$record_type", $as_xml, $noxml, $nosanitize); |
253 |
$num_records_exported = export_marc_records_from_sth($record_type, $sth, "$directory/$record_type", $as_xml, $noxml, $nosanitize); |
Lines 697-702
Parameters:
Link Here
|
697 |
table. Cannot be used with -r |
704 |
table. Cannot be used with -r |
698 |
or -s. |
705 |
or -s. |
699 |
|
706 |
|
|
|
707 |
--skip-deletes select only updated records marked |
708 |
in the zebraqueue table, not deletes. |
709 |
Only effective with -z. |
710 |
|
700 |
-r clear Zebra index before |
711 |
-r clear Zebra index before |
701 |
adding records to index. Implies -w. |
712 |
adding records to index. Implies -w. |
702 |
|
713 |
|
703 |
- |
|
|