Bugzilla – Attachment 102837 Details for
Bug 21865
Add Elasticsearch support to, and improve verbose output of, `remove_unused_authorities.pl`
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21865: ES compatiblity of remove_unused_authorities.pl
Bug-21865-ES-compatiblity-of-removeunusedauthoriti.patch (text/plain), 3.44 KB, created by
Jonathan Druart
on 2020-04-13 13:45:25 UTC
(
hide
)
Description:
Bug 21865: ES compatiblity of remove_unused_authorities.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-13 13:45:25 UTC
Size:
3.44 KB
patch
obsolete
>From 164b210dc9b92c20978f1cf5915ca87c6b43b51f Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Mon, 19 Nov 2018 15:19:46 +0100 >Subject: [PATCH] Bug 21865: ES compatiblity of remove_unused_authorities.pl > >The script misc/migration_tools/remove_unused_authorities.pl directly checks if Zebra search is OK. > >This patch changes so that this test is only if Zebra is the search engine. >It also adds a test on the search off any authority number indexed (index 'an'). >With Zebra its : an,alwaysmatches='' >With ES its : an:* >This test ensure that biblios records are indexed and that not all autorities will be deleted. > >Test plan: >1) On a catalog create a new authority >2) Use Zebra in systempreference SearchEngine >3) Stop Zebra server >4) Run misc/migration_tools/remove_unused_authorities.pl -c >5) The script does nothing and says : > Zebra server seems not to be available. This script needs Zebra runs. >6) Restart Zebra server >7) Delete biblio index base >8) Run misc/migration_tools/remove_unused_authorities.pl -c >9) The script does nothing and says : > Searching authority number in biblio records seems not to be available : an,alwaysmatches='' >10) Use ElasticSearch in systempreference SearchEngine >11) Delete biblio index base >12) Run misc/migration_tools/remove_unused_authorities.pl -c >13) The script does nothing and says : > Searching authority number in biblio records seems not to be available : an:* > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../remove_unused_authorities.pl | 25 ++++++++++++++----- > 1 file changed, 19 insertions(+), 6 deletions(-) > >diff --git a/misc/migration_tools/remove_unused_authorities.pl b/misc/migration_tools/remove_unused_authorities.pl >index 70f2037f6a..30acf5df98 100755 >--- a/misc/migration_tools/remove_unused_authorities.pl >+++ b/misc/migration_tools/remove_unused_authorities.pl >@@ -49,11 +49,25 @@ if (@authtypes) { > print "Restricted to authority type(s) : ".join(',', @authtypes).".\n"; > } > >-my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode(); >-if ( $errZebraConnection == 10000 ) { >- die "Zebra server seems not to be available. This script needs Zebra runs."; >-} elsif ( $errZebraConnection ) { >- die "Error from Zebra: $errZebraConnection"; >+my $searcher = Koha::SearchEngine::Search->new( { index => 'biblios' } ); >+my $checksearch; >+if ( C4::Context->preference("SearchEngine") eq 'Zebra' ) { >+ # Check server state >+ my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode(); >+ if ( $errZebraConnection == 10000 ) { >+ die "Zebra server seems not to be available. This script needs Zebra runs."; >+ } elsif ( $errZebraConnection ) { >+ die "Error from Zebra: $errZebraConnection"; >+ } >+ $checksearch = q{an,alwaysmatches=''}; >+} >+else { >+ $checksearch = q{an:*}; >+} >+# Check search on authority number as at least one result >+my ($err,$res,$nb) = $searcher->simple_search_compat($checksearch,0,10); >+unless ($nb > 0) { >+ die "Searching authority number in biblio records seems not to be available : $checksearch"; > } > > my $dbh=C4::Context->dbh; >@@ -68,7 +82,6 @@ $rqselect->execute(@authtypes); > my $counter=0; > my $totdeleted=0; > my $totundeleted=0; >-my $searcher = Koha::SearchEngine::Search->new({index => 'biblios'}); > while (my $data=$rqselect->fetchrow_hashref){ > $counter++; > print 'authid='.$data->{'authid'}; >-- >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 21865
:
82558
|
82559
|
82560
|
100577
|
100918
|
100919
|
100920
|
100921
|
102836
| 102837 |
102838
|
102839