|
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<-v|--verbose> |
71 |
=item B<-v|--verbose> |
| 68 |
|
72 |
|
|
Lines 97-103
my $verbose = 0;
Link Here
|
| 97 |
my $commit = 5000; |
101 |
my $commit = 5000; |
| 98 |
my ($delete, $help, $man); |
102 |
my ($delete, $help, $man); |
| 99 |
my ($index_biblios, $index_authorities); |
103 |
my ($index_biblios, $index_authorities); |
| 100 |
my (@biblionumbers); |
104 |
my (@biblionumbers,@authids); |
| 101 |
|
105 |
|
| 102 |
$|=1; # flushes output |
106 |
$|=1; # flushes output |
| 103 |
|
107 |
|
|
Lines 107-112
GetOptions(
Link Here
|
| 107 |
'a|authorities' => \$index_authorities, |
111 |
'a|authorities' => \$index_authorities, |
| 108 |
'b|biblios' => \$index_biblios, |
112 |
'b|biblios' => \$index_biblios, |
| 109 |
'bn|bnumber=i' => \@biblionumbers, |
113 |
'bn|bnumber=i' => \@biblionumbers, |
|
|
114 |
'ai|authid=i' => \@authids, |
| 110 |
'v|verbose+' => \$verbose, |
115 |
'v|verbose+' => \$verbose, |
| 111 |
'h|help' => \$help, |
116 |
'h|help' => \$help, |
| 112 |
'man' => \$man, |
117 |
'man' => \$man, |
|
Lines 141-152
if ($index_biblios) {
Link Here
|
| 141 |
} |
146 |
} |
| 142 |
if ($index_authorities) { |
147 |
if ($index_authorities) { |
| 143 |
_log(1, "Indexing authorities\n"); |
148 |
_log(1, "Indexing authorities\n"); |
| 144 |
if (@biblionumbers) { |
149 |
if (@authids) { |
| 145 |
$next = sub { |
150 |
$next = sub { |
| 146 |
my $r = shift @biblionumbers; |
151 |
my $r = shift @authids; |
| 147 |
return () unless defined $r; |
152 |
return () unless defined $r; |
| 148 |
my $a = Koha::MetadataRecord::Authority->get_from_authid($r); |
153 |
my $a = Koha::MetadataRecord::Authority->get_from_authid($r); |
| 149 |
return ($r, $a->record); |
154 |
return ($r, $a); |
| 150 |
}; |
155 |
}; |
| 151 |
} else { |
156 |
} else { |
| 152 |
my $records = Koha::MetadataRecord::Authority->get_all_authorities_iterator(); |
157 |
my $records = Koha::MetadataRecord::Authority->get_all_authorities_iterator(); |
|
Lines 180-186
sub do_reindex {
Link Here
|
| 180 |
my $commit_count = $commit; |
185 |
my $commit_count = $commit; |
| 181 |
my ( @id_buffer, @commit_buffer ); |
186 |
my ( @id_buffer, @commit_buffer ); |
| 182 |
while ( my $record = $next->() ) { |
187 |
while ( my $record = $next->() ) { |
| 183 |
my $id = $record->id; |
188 |
my $id = $record->id // $record->authid; |
| 184 |
my $record = $record->record; |
189 |
my $record = $record->record; |
| 185 |
$count++; |
190 |
$count++; |
| 186 |
if ( $verbose == 1 ) { |
191 |
if ( $verbose == 1 ) { |
| 187 |
- |
|
|