Bugzilla – Attachment 148259 Details for
Bug 33243
Reindex only Biblios changed in the last x minutes in Elasticsearch (ES)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33243 - Reindex only Biblios changed in the last x minutes in Elasticsearch (ES)
Bug-33243---Reindex-only-Biblios-changed-in-the-la.patch (text/plain), 2.62 KB, created by
Mark Hofstetter
on 2023-03-16 12:30:32 UTC
(
hide
)
Description:
Bug 33243 - Reindex only Biblios changed in the last x minutes in Elasticsearch (ES)
Filename:
MIME Type:
Creator:
Mark Hofstetter
Created:
2023-03-16 12:30:32 UTC
Size:
2.62 KB
patch
obsolete
>From 14d6763500c418aaaba2c46a359df8c69627235f Mon Sep 17 00:00:00 2001 >From: Mark Hofstetter <mark@hofstetter.at> >Date: Thu, 16 Mar 2023 13:20:15 +0100 >Subject: [PATCH] Bug 33243 - Reindex only Biblios changed in the last x > minutes in Elasticsearch (ES) > >add a command line option to > >rebuild_elasticsearch.pl > >to only reindex Biblios changed in the last x minutes >rebuild_elasticsearch.pl -v -b --minutes 100 > >Reason: we (and others) sometime encounter problem when records are created (especially without items) AND are not automatically indexed in ES > >To test: > >instance has to use elasticsearch > >0. apply patch >1. create or change new record (biblio) >2. run "rebuild_elasticsearch.pl -v -b --minutes 10" >3. if nothing else "happened" on this intance in the last 10 minutes, this command >should yield "1 record indexed" >4. record should be found in Web Search > >Sponsored-by: Wien Museum >--- > misc/search_tools/rebuild_elasticsearch.pl | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > >diff --git a/misc/search_tools/rebuild_elasticsearch.pl b/misc/search_tools/rebuild_elasticsearch.pl >index 337ac19dd2..a01381247d 100755 >--- a/misc/search_tools/rebuild_elasticsearch.pl >+++ b/misc/search_tools/rebuild_elasticsearch.pl >@@ -36,6 +36,7 @@ B<rebuild_elasticsearch.pl> > [B<-ai|--authid>] > [B<-p|--processes>] > [B<-v|--verbose>] >+[B<-t|--minutes>] > [B<-h|--help>] > [B<--man>] > >@@ -97,6 +98,10 @@ work in parallel on multicore systems. By default, a single process is used. > By default, this program only emits warnings and errors. This makes it talk > more. Add more to make it even more wordy, in particular when debugging. > >+=item B<-t|--minutes> >+ >+indexes only the Biblios whose timestamp has changed in the last x minutes >+ > =item B<-h|--help> > > Help! >@@ -129,6 +134,7 @@ my $commit = 5000; > my ($delete, $reset, $help, $man, $processes); > my ($index_biblios, $index_authorities); > my (@biblionumbers,@authids); >+my ($minutes); > my $desc; > > $|=1; # flushes output >@@ -144,6 +150,7 @@ GetOptions( > 'ai|authid=i' => \@authids, > 'p|processes=i' => \$processes, > 'v|verbose+' => \$verbose, >+ 't|minutes=i' => \$minutes, > 'h|help' => \$help, > 'man' => \$man, > ); >@@ -198,6 +205,19 @@ if( $desc ){ > } > > my $next; >+ >+if ($minutes) { >+ my $new_biblios = Koha::Biblios->search(\[ 'timestamp >= NOW() - INTERVAL ? MINUTE', $minutes ]); >+ while (my $b = $new_biblios->next) { >+ push @biblionumbers, $b->biblionumber; >+ } >+ >+ if (scalar @biblionumbers == 0) { >+ say "nothing to do"; >+ exit; >+ } >+} >+ > if ($index_biblios) { > _log(1, "Indexing biblios\n"); > if (@biblionumbers) { >-- >2.20.1
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 33243
: 148259