Lines 61-68
specifying neither and so both get indexed.
Link Here
|
61 |
=item B<-bn|--bnumber> |
61 |
=item B<-bn|--bnumber> |
62 |
|
62 |
|
63 |
Only index the supplied biblionumber, mostly for testing purposes. May be |
63 |
Only index the supplied biblionumber, mostly for testing purposes. May be |
64 |
repeated. This also applies to authorities via authid, so if you're using it, |
64 |
repeated. |
65 |
you probably only want to do one or the other at a time. |
65 |
|
|
|
66 |
=item B<-ai|--authid> |
67 |
|
68 |
Only index the supplied authority id, mostly for testing purposes. May be |
69 |
repeated. |
66 |
|
70 |
|
67 |
=item B<-p|--processes> |
71 |
=item B<-p|--processes> |
68 |
|
72 |
|
Lines 104-110
my $verbose = 0;
Link Here
|
104 |
my $commit = 5000; |
108 |
my $commit = 5000; |
105 |
my ($delete, $help, $man, $processes); |
109 |
my ($delete, $help, $man, $processes); |
106 |
my ($index_biblios, $index_authorities); |
110 |
my ($index_biblios, $index_authorities); |
107 |
my (@record_numbers); |
111 |
my (@biblionumbers,@authids); |
108 |
|
112 |
|
109 |
$|=1; # flushes output |
113 |
$|=1; # flushes output |
110 |
|
114 |
|
Lines 113-119
GetOptions(
Link Here
|
113 |
'd|delete' => \$delete, |
117 |
'd|delete' => \$delete, |
114 |
'a|authorities' => \$index_authorities, |
118 |
'a|authorities' => \$index_authorities, |
115 |
'b|biblios' => \$index_biblios, |
119 |
'b|biblios' => \$index_biblios, |
116 |
'bn|bnumber=i' => \@record_numbers, |
120 |
'bn|bnumber=i' => \@biblionumbers, |
|
|
121 |
'ai|authid=i' => \@authids, |
117 |
'p|processes=i' => \$processes, |
122 |
'p|processes=i' => \$processes, |
118 |
'v|verbose+' => \$verbose, |
123 |
'v|verbose+' => \$verbose, |
119 |
'h|help' => \$help, |
124 |
'h|help' => \$help, |
Lines 125-132
unless ($index_authorities || $index_biblios) {
Link Here
|
125 |
$index_authorities = $index_biblios = 1; |
130 |
$index_authorities = $index_biblios = 1; |
126 |
} |
131 |
} |
127 |
|
132 |
|
128 |
if ($processes && @record_numbers) { |
133 |
if ($processes && ( @biblionumbers || @authids) ) { |
129 |
die "Argument p|processes cannot be combined with bn|bnumber"; |
134 |
die "Argument p|processes cannot be combined with bn|bnumber or ai|authid"; |
130 |
} |
135 |
} |
131 |
|
136 |
|
132 |
pod2usage(1) if $help; |
137 |
pod2usage(1) if $help; |
Lines 162-170
if ($slice_count > 1) {
Link Here
|
162 |
my $next; |
167 |
my $next; |
163 |
if ($index_biblios) { |
168 |
if ($index_biblios) { |
164 |
_log(1, "Indexing biblios\n"); |
169 |
_log(1, "Indexing biblios\n"); |
165 |
if (@record_numbers) { |
170 |
if (@biblionumbers) { |
166 |
$next = sub { |
171 |
$next = sub { |
167 |
my $r = shift @record_numbers; |
172 |
my $r = shift @biblionumbers; |
168 |
return () unless defined $r; |
173 |
return () unless defined $r; |
169 |
return ($r, Koha::BiblioUtils->get_from_biblionumber($r, item_data => 1 )); |
174 |
return ($r, Koha::BiblioUtils->get_from_biblionumber($r, item_data => 1 )); |
170 |
}; |
175 |
}; |
Lines 178-189
if ($index_biblios) {
Link Here
|
178 |
} |
183 |
} |
179 |
if ($index_authorities) { |
184 |
if ($index_authorities) { |
180 |
_log(1, "Indexing authorities\n"); |
185 |
_log(1, "Indexing authorities\n"); |
181 |
if (@record_numbers) { |
186 |
if (@authids) { |
182 |
$next = sub { |
187 |
$next = sub { |
183 |
my $r = shift @record_numbers; |
188 |
my $r = shift @authids; |
184 |
return () unless defined $r; |
189 |
return () unless defined $r; |
185 |
my $a = Koha::MetadataRecord::Authority->get_from_authid($r); |
190 |
my $a = Koha::MetadataRecord::Authority->get_from_authid($r); |
186 |
return ($r, $a->record); |
191 |
return ($r, $a); |
187 |
}; |
192 |
}; |
188 |
} else { |
193 |
} else { |
189 |
my $records = Koha::MetadataRecord::Authority->get_all_authorities_iterator(%iterator_options); |
194 |
my $records = Koha::MetadataRecord::Authority->get_all_authorities_iterator(%iterator_options); |
Lines 248-254
sub _do_reindex {
Link Here
|
248 |
my $commit_count = $commit; |
253 |
my $commit_count = $commit; |
249 |
my ( @id_buffer, @commit_buffer ); |
254 |
my ( @id_buffer, @commit_buffer ); |
250 |
while ( my $record = $next->() ) { |
255 |
while ( my $record = $next->() ) { |
251 |
my $id = $record->id; |
256 |
my $id = $record->id // $record->authid; |
252 |
my $record = $record->record; |
257 |
my $record = $record->record; |
253 |
$count++; |
258 |
$count++; |
254 |
if ( $verbose == 1 ) { |
259 |
if ( $verbose == 1 ) { |
255 |
- |
|
|