@@ -, +, @@ Elasticsearch --- misc/search_tools/rebuild_elastic_search.pl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) --- a/misc/search_tools/rebuild_elastic_search.pl +++ a/misc/search_tools/rebuild_elastic_search.pl @@ -61,8 +61,12 @@ specifying neither and so both get indexed. =item B<-bn|--bnumber> Only index the supplied biblionumber, mostly for testing purposes. May be -repeated. This also applies to authorities via authid, so if you're using it, -you probably only want to do one or the other at a time. +repeated. + +=item B<-ai|--authid> + +Only index the supplied authority id, mostly for testing purposes. May be +repeated. =item B<-v|--verbose> @@ -97,7 +101,7 @@ my $verbose = 0; my $commit = 5000; my ($delete, $help, $man); my ($index_biblios, $index_authorities); -my (@biblionumbers); +my (@biblionumbers,@authids); $|=1; # flushes output @@ -107,6 +111,7 @@ GetOptions( 'a|authorities' => \$index_authorities, 'b|biblios' => \$index_biblios, 'bn|bnumber=i' => \@biblionumbers, + 'ai|authid=i' => \@authids, 'v|verbose+' => \$verbose, 'h|help' => \$help, 'man' => \$man, @@ -141,12 +146,12 @@ if ($index_biblios) { } if ($index_authorities) { _log(1, "Indexing authorities\n"); - if (@biblionumbers) { + if (@authids) { $next = sub { - my $r = shift @biblionumbers; + my $r = shift @authids; return () unless defined $r; my $a = Koha::MetadataRecord::Authority->get_from_authid($r); - return ($r, $a->record); + return ($r, $a); }; } else { my $records = Koha::MetadataRecord::Authority->get_all_authorities_iterator(); @@ -180,7 +185,7 @@ sub do_reindex { my $commit_count = $commit; my ( @id_buffer, @commit_buffer ); while ( my $record = $next->() ) { - my $id = $record->id; + my $id = $record->id // $record->authid; my $record = $record->record; $count++; if ( $verbose == 1 ) { --