Bugzilla – Attachment 91151 Details for
Bug 22826
Allow indexing of individual authority records in Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22826: Allow indexing of individual authorities in Elasticsearch
Bug-22826-Allow-indexing-of-individual-authorities.patch (text/plain), 4.07 KB, created by
Nick Clemens (kidclamp)
on 2019-07-01 14:38:05 UTC
(
hide
)
Description:
Bug 22826: Allow indexing of individual authorities in Elasticsearch
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-07-01 14:38:05 UTC
Size:
4.07 KB
patch
obsolete
>From b09835bef7cdd02405e735ba40e7a86a75f84966 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 2 May 2019 10:21:36 +0000 >Subject: [PATCH] Bug 22826: Allow indexing of individual authorities in > Elasticsearch > >To test: >1 - perl misc/search_tools/rebuild_elastic_search.pl -h >2 - Note it indicates the bn option can be passed to index individual authids >3 - perl misc/search_tools/rebuild_elastic_search.pl -a -bn 92 -v >4 - Note the error >5 - Apply patch >6 - perl misc/search_tools/rebuild_elastic_search.pl -h >7 - Note new option ai|authid for indexing individual authids >8 - Note updated text for bn|biblionumber option >9 - perl misc/search_tools/rebuild_elastic_search.pl -a -bn 92 -v >10 - No errors, but no records indexed >11 - perl misc/search_tools/rebuild_elastic_search.pl -a -ai 92 -v >12 - 1 record indexed >13 - perl misc/search_tools/rebuild_elastic_search.pl -ai 92 -bn 92 -v >14 - 1 authority record and 1 biblio record indexed > >Signed-off-by: Michal Denar <black23@gmail.com> >--- > misc/search_tools/rebuild_elasticsearch.pl | 29 +++++++++++++++++------------ > 1 file changed, 17 insertions(+), 12 deletions(-) > >diff --git a/misc/search_tools/rebuild_elasticsearch.pl b/misc/search_tools/rebuild_elasticsearch.pl >index 1199b63922..b5237cb1a4 100755 >--- a/misc/search_tools/rebuild_elasticsearch.pl >+++ b/misc/search_tools/rebuild_elasticsearch.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<-p|--processes> > >@@ -104,7 +108,7 @@ my $verbose = 0; > my $commit = 5000; > my ($delete, $help, $man, $processes); > my ($index_biblios, $index_authorities); >-my (@record_numbers); >+my (@biblionumbers,@authids); > > $|=1; # flushes output > >@@ -113,7 +117,8 @@ GetOptions( > 'd|delete' => \$delete, > 'a|authorities' => \$index_authorities, > 'b|biblios' => \$index_biblios, >- 'bn|bnumber=i' => \@record_numbers, >+ 'bn|bnumber=i' => \@biblionumbers, >+ 'ai|authid=i' => \@authids, > 'p|processes=i' => \$processes, > 'v|verbose+' => \$verbose, > 'h|help' => \$help, >@@ -125,8 +130,8 @@ unless ($index_authorities || $index_biblios) { > $index_authorities = $index_biblios = 1; > } > >-if ($processes && @record_numbers) { >- die "Argument p|processes cannot be combined with bn|bnumber"; >+if ($processes && ( @biblionumbers || @authids) ) { >+ die "Argument p|processes cannot be combined with bn|bnumber or ai|authid"; > } > > pod2usage(1) if $help; >@@ -162,9 +167,9 @@ if ($slice_count > 1) { > my $next; > if ($index_biblios) { > _log(1, "Indexing biblios\n"); >- if (@record_numbers) { >+ if (@biblionumbers) { > $next = sub { >- my $r = shift @record_numbers; >+ my $r = shift @biblionumbers; > return () unless defined $r; > return ($r, Koha::BiblioUtils->get_from_biblionumber($r, item_data => 1 )); > }; >@@ -178,12 +183,12 @@ if ($index_biblios) { > } > if ($index_authorities) { > _log(1, "Indexing authorities\n"); >- if (@record_numbers) { >+ if (@authids) { > $next = sub { >- my $r = shift @record_numbers; >+ 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(%iterator_options); >@@ -248,7 +253,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 ) { >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22826
:
89218
|
89330
|
91151
|
94660