Bugzilla – Attachment 95110 Details for
Bug 22831
Add a maintenance script for checking DB vs index counts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22831: (follow-up) Determine where the record is missing and provide link, show counter
Bug-22831-follow-up-Determine-where-the-record-is-.patch (text/plain), 2.14 KB, created by
Nick Clemens (kidclamp)
on 2019-11-06 14:38:12 UTC
(
hide
)
Description:
Bug 22831: (follow-up) Determine where the record is missing and provide link, show counter
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-11-06 14:38:12 UTC
Size:
2.14 KB
patch
obsolete
>From f87cca4ed9ba1d2882ce5de4d45de6c1252b9d71 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 6 Nov 2019 14:37:01 +0000 >Subject: [PATCH] Bug 22831: (follow-up) Determine where the record is missing > and provide link, show counter > >--- > misc/maintenance/compare_es_to_db.pl | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > >diff --git a/misc/maintenance/compare_es_to_db.pl b/misc/maintenance/compare_es_to_db.pl >index 9fab08a759..90ec40d917 100644 >--- a/misc/maintenance/compare_es_to_db.pl >+++ b/misc/maintenance/compare_es_to_db.pl >@@ -30,12 +30,14 @@ B<compare_es_to_db.pl> > =cut > > use Modern::Perl; >-use Koha::Items; >-use Koha::SearchEngine::Elasticsearch; > use Array::Utils qw( array_diff ); > >-use Koha::Biblios; >+use C4::Context; >+ > use Koha::Authorities; >+use Koha::Biblios; >+use Koha::Items; >+use Koha::SearchEngine::Elasticsearch; > > foreach my $index ( ('biblios','authorities') ){ > print "=================\n"; >@@ -67,7 +69,7 @@ foreach my $index ( ('biblios','authorities') ){ > print "Fetching Elasticsearch records ids"; > while (my $doc = $scroll->next ){ > print "." if !($i % 500); >- print "\nFetching next 5000" if !($i % 5000); >+ print "\n$i records retrieved" if !($i % 5000); > push @es_ids, $doc->{_id}; > $i++; > } >@@ -77,6 +79,13 @@ foreach my $index ( ('biblios','authorities') ){ > my @diff = array_diff(@db_records, @es_ids ); > print "All records match\n" unless @diff; > foreach my $problem (@diff){ >- print "Record #$problem is not in both sources\n"; >+ if ( (grep $problem, @db_records) ){ >+ print "Record $problem exists in Koha but not ES\n"; >+ print " Visit here to see record: ".C4::Context->preference('OPACBaseURL')."/cgi-bin/koha/opac-detail.pl?biblionumber=".$problem."\n"; >+ } else { >+ print "Record $problem exists in ES but not Koha\n"; >+ my $es_params = $searcher->get_elasticsearch_params; >+ print " Enter this command to view record: curl $es_params->{nodes}[0]/$es_params->{index_name}/data/$problem?pretty=true\n"; >+ } > } > } >-- >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 22831
:
89233
|
95077
|
95105
|
95109
|
95110
|
95154
|
95155
|
95156
|
95157
|
95176
|
96804
|
96805
|
96806
|
97339
|
97340
|
97341
|
97783