Bugzilla – Attachment 57516 Details for
Bug 16588
Remove the Readonly dependency (again)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16588: Remove Readonly from SearchEngine
Bug-16588-Remove-Readonly-from-SearchEngine.patch (text/plain), 15.52 KB, created by
Jonathan Druart
on 2016-11-16 07:16:11 UTC
(
hide
)
Description:
Bug 16588: Remove Readonly from SearchEngine
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-11-16 07:16:11 UTC
Size:
15.52 KB
patch
obsolete
>From d0767dd98f9b8b8d49d1a6977ace47dda71523fc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 22 Jul 2016 08:57:20 +0100 >Subject: [PATCH] Bug 16588: Remove Readonly from SearchEngine > >Test plan: >Make sure you are able to reindex and search for records at the OPAC >using ElasticSearch > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/AuthoritiesMarc.pm | 4 ++-- > C4/Biblio.pm | 4 ++-- > C4/Items.pm | 2 +- > C4/Matcher.pm | 2 +- > C4/XISBN.pm | 2 +- > Koha/SearchEngine.pm | 7 ++++--- > Koha/SearchEngine/Elasticsearch.pm | 7 ++++--- > Koha/SearchEngine/QueryBuilder.pm | 2 +- > acqui/neworderbiblio.pl | 4 ++-- > authorities/authorities-home.pl | 4 ++-- > authorities/authorities-list.pl | 2 +- > catalogue/search.pl | 4 ++-- > cataloguing/addbooks.pl | 4 ++-- > cataloguing/value_builder/marc21_linking_section.pl | 2 +- > cataloguing/value_builder/unimarc_field_4XX.pl | 2 +- > circ/circulation.pl | 2 +- > misc/migration_tools/bulkmarcimport.pl | 4 ++-- > misc/search_tools/rebuild_elastic_search.pl | 4 ++-- > opac/opac-authorities-home.pl | 4 ++-- > serials/subscription-bib-search.pl | 2 +- > 20 files changed, 35 insertions(+), 33 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index e14c85f..5c66960 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -353,7 +353,7 @@ sub CountUsage { > $query= "an:".$authid; > # Should really be replaced with a real count call, this is a > # bad way. >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > my ($err,$res,$result) = $searcher->simple_search_compat($query,0,1); > if ($err) { > warn "Error: $err from search $query"; >@@ -827,7 +827,7 @@ sub FindDuplicateAuthority { > $_->[1]=~s/$filtervalues/ /g; $query.= " $op he:\"".$_->[1]."\"" if ($_->[0]=~/[A-z]/); > } > } >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::AUTHORITIES_INDEX}); >+ my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::AUTHORITIES_INDEX}); > my ($error, $results, $total_hits) = $searcher->simple_search_compat( $query, 0, 1 ); > # there is at least 1 result => return the 1st one > if (!defined $error && @{$results} ) { >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 6d64e80..e102fff 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2978,8 +2978,8 @@ sub ModZebra { > my $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new( > { > index => $server eq 'biblioserver' >- ? $Koha::SearchEngine::BIBLIOS_INDEX >- : $Koha::SearchEngine::AUTHORITIES_INDEX >+ ? Koha::SearchEngine::BIBLIOS_INDEX >+ : Koha::SearchEngine::AUTHORITIES_INDEX > } > ); > if ( $op eq 'specialUpdate' ) { >diff --git a/C4/Items.pm b/C4/Items.pm >index 0fc7f10..4aefb18 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -2553,7 +2553,7 @@ sub GetAnalyticsCount { > ### ZOOM search here > my $query; > $query= "hi=".$itemnumber; >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > my ($err,$res,$result) = $searcher->simple_search_compat($query,0,10); > return ($result); > } >diff --git a/C4/Matcher.pm b/C4/Matcher.pm >index 40e6e5f..011d956 100644 >--- a/C4/Matcher.pm >+++ b/C4/Matcher.pm >@@ -660,7 +660,7 @@ sub get_matches { > #NOTE: double-quote the values so you don't get a "Embedded truncation not supported" error when a term has a ? in it. > } > >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > ( $error, $searchresults, $total_hits ) = > $searcher->simple_search_compat( $query, 0, $max_matches ); > } >diff --git a/C4/XISBN.pm b/C4/XISBN.pm >index 5512633..008733b 100644 >--- a/C4/XISBN.pm >+++ b/C4/XISBN.pm >@@ -66,7 +66,7 @@ sub _get_biblio_from_xisbn { > my $xisbn = shift; > my $dbh = C4::Context->dbh; > >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( "nb=$xisbn", 0, 1 ); > return unless ( !$errors && scalar @$results ); > >diff --git a/Koha/SearchEngine.pm b/Koha/SearchEngine.pm >index 70ef799..2a3c7e4 100644 >--- a/Koha/SearchEngine.pm >+++ b/Koha/SearchEngine.pm >@@ -19,7 +19,6 @@ package Koha::SearchEngine; > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > > use Modern::Perl; >-use Readonly; > > =head1 NAME > >@@ -42,5 +41,7 @@ indicate that you want to be working with the authorities index. > # Search engine implementations should compare against these to determine > # what bit of storage is being requested. They will be sensible strings so > # may be used for, e.g., directory names. >-Readonly our $BIBLIOS_INDEX => 'biblios'; >-Readonly our $AUTHORITIES_INDEX => 'authorities'; >+use constant { >+ BIBLIOS_INDEX => 'biblios', >+ AUTHORITIES_INDEX => 'authorities', >+}; >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 35a6540..be34f2d 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -28,7 +28,6 @@ use Koha::SearchMarcMaps; > use Carp; > use JSON; > use Modern::Perl; >-use Readonly; > use YAML::Syck; > > use Data::Dumper; # TODO remove >@@ -37,8 +36,10 @@ __PACKAGE__->mk_ro_accessors(qw( index )); > __PACKAGE__->mk_accessors(qw( sort_fields )); > > # Constants to refer to the standard index names >-Readonly our $BIBLIOS_INDEX => 'biblios'; >-Readonly our $AUTHORITIES_INDEX => 'authorities'; >+use constant { >+ BIBLIOS_INDEX => 'biblios', >+ AUTHORITIES_INDEX => 'authorities', >+}; > > =head1 NAME > >diff --git a/Koha/SearchEngine/QueryBuilder.pm b/Koha/SearchEngine/QueryBuilder.pm >index 62a6b2c..64e81fd 100644 >--- a/Koha/SearchEngine/QueryBuilder.pm >+++ b/Koha/SearchEngine/QueryBuilder.pm >@@ -33,7 +33,7 @@ and just get whatever querybuilder you need. > =head1 SYNOPSIS > > use Koha::SearchEngine::QueryBuilder; >- my $qb = Koha::SearchEngine::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $qb = Koha::SearchEngine::QueryBuilder->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > > =head1 METHODS > >diff --git a/acqui/neworderbiblio.pl b/acqui/neworderbiblio.pl >index 01fb1e2..28592a5 100755 >--- a/acqui/neworderbiblio.pl >+++ b/acqui/neworderbiblio.pl >@@ -102,8 +102,8 @@ my @operands = $query; > my $QParser; > $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser')); > my $builtquery; >-my $builder = Koha::SearchEngine::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >-my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+my $builder = Koha::SearchEngine::QueryBuilder->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); >+my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > if ($QParser) { > $builtquery = $query; > } else { >diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl >index 6e0a8fe..87e9f85 100755 >--- a/authorities/authorities-home.pl >+++ b/authorities/authorities-home.pl >@@ -80,9 +80,9 @@ if ( $op eq "do_search" ) { > my $resultsperpage = $query->param('resultsperpage') || 20; > > my $builder = Koha::SearchEngine::QueryBuilder->new( >- { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); >+ { index => Koha::SearchEngine::AUTHORITIES_INDEX } ); > my $searcher = Koha::SearchEngine::Search->new( >- { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); >+ { index => Koha::SearchEngine::AUTHORITIES_INDEX } ); > my $search_query = $builder->build_authorities_query_compat( > [$marclist], [$and_or], [$excluding], [$operator], > [$value], $authtypecode, $orderby >diff --git a/authorities/authorities-list.pl b/authorities/authorities-list.pl >index 0afa5e7..c361c78 100755 >--- a/authorities/authorities-list.pl >+++ b/authorities/authorities-list.pl >@@ -26,7 +26,7 @@ foreach my $authority (@$dataauthorities){ > my $query; > $query= "an=".$authority->{'authid'}; > # search for biblios mapped >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > my ($err,undef,$used) = $searcher->simple_search_compat($query,0,1); > if (defined $err) { > $used = 0; >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 5855bf1..4d93362 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -462,9 +462,9 @@ my $expanded_facet = $params->{'expand'}; > my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type); > > my $builder = Koha::SearchEngine::QueryBuilder->new( >- { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >+ { index => Koha::SearchEngine::BIBLIOS_INDEX } ); > my $searcher = Koha::SearchEngine::Search->new( >- { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >+ { index => Koha::SearchEngine::BIBLIOS_INDEX } ); > > ## I. BUILD THE QUERY > ( >diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl >index 1d52bb8..4ca466b 100755 >--- a/cataloguing/addbooks.pl >+++ b/cataloguing/addbooks.pl >@@ -68,9 +68,9 @@ if ($query) { > $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser')); > my $builtquery; > my $builder = Koha::SearchEngine::QueryBuilder->new( >- { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >+ { index => Koha::SearchEngine::BIBLIOS_INDEX } ); > my $searcher = Koha::SearchEngine::Search->new( >- { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >+ { index => Koha::SearchEngine::BIBLIOS_INDEX } ); > if ($QParser) { > $builtquery = $query; > } else { >diff --git a/cataloguing/value_builder/marc21_linking_section.pl b/cataloguing/value_builder/marc21_linking_section.pl >index 7efa49e..dc9250d 100755 >--- a/cataloguing/value_builder/marc21_linking_section.pl >+++ b/cataloguing/value_builder/marc21_linking_section.pl >@@ -182,7 +182,7 @@ my $launcher = sub { > $op = 'and'; > } > my $searcher = Koha::SearchEngine::Search->new( >- { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >+ { index => Koha::SearchEngine::BIBLIOS_INDEX } ); > $search = 'kw:' . $search . " $op mc-itemtype:" . $itype if $itype; > my ( $errors, $results, $total_hits ) = > $searcher->simple_search_compat( $search, >diff --git a/cataloguing/value_builder/unimarc_field_4XX.pl b/cataloguing/value_builder/unimarc_field_4XX.pl >index 75c9dec..2b909b9 100755 >--- a/cataloguing/value_builder/unimarc_field_4XX.pl >+++ b/cataloguing/value_builder/unimarc_field_4XX.pl >@@ -368,7 +368,7 @@ sub plugin { > $op = 'and'; > } > $search = 'kw:'.$search." $op mc-itemtype:".$itype if $itype; >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat($search, $startfrom * $resultsperpage, $resultsperpage ); > if (defined $errors ) { > $results = []; >diff --git a/circ/circulation.pl b/circ/circulation.pl >index ded56c4..d0dda63 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -355,7 +355,7 @@ if (@$barcodes) { > { > $template_params->{FALLBACK} = 1; > >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > my $query = "kw=" . $barcode; > my ( $searcherror, $results, $total_hits ) = $searcher->simple_search_compat($query, 0, 10); > >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index d007d29..02d87d6 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -223,8 +223,8 @@ my $searcher = Koha::SearchEngine::Search->new( > { > index => ( > $authorities >- ? $Koha::SearchEngine::AUTHORITIES_INDEX >- : $Koha::SearchEngine::BIBLIOS_INDEX >+ ? Koha::SearchEngine::AUTHORITIES_INDEX >+ : Koha::SearchEngine::BIBLIOS_INDEX > ) > } > ); >diff --git a/misc/search_tools/rebuild_elastic_search.pl b/misc/search_tools/rebuild_elastic_search.pl >index 6faa32c..bec107d 100755 >--- a/misc/search_tools/rebuild_elastic_search.pl >+++ b/misc/search_tools/rebuild_elastic_search.pl >@@ -136,7 +136,7 @@ if ($index_biblios) { > $records->next(); > } > } >- do_reindex($next, $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX); >+ do_reindex($next, Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX); > } > if ($index_authorities) { > _log(1, "Indexing authorities\n"); >@@ -153,7 +153,7 @@ if ($index_authorities) { > $records->next(); > } > } >- do_reindex($next, $Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX); >+ do_reindex($next, Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX); > } > > sub do_reindex { >diff --git a/opac/opac-authorities-home.pl b/opac/opac-authorities-home.pl >index d92166b..60d9023 100755 >--- a/opac/opac-authorities-home.pl >+++ b/opac/opac-authorities-home.pl >@@ -59,9 +59,9 @@ if ( $op eq "do_search" ) { > > my @tags; > my $builder = Koha::SearchEngine::QueryBuilder->new( >- { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); >+ { index => Koha::SearchEngine::AUTHORITIES_INDEX } ); > my $searcher = Koha::SearchEngine::Search->new( >- { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); >+ { index => Koha::SearchEngine::AUTHORITIES_INDEX } ); > my $search_query = $builder->build_authorities_query_compat( \@marclist, \@and_or, > \@excluding, \@operator, \@value, $authtypecode, $orderby ); > my $offset = ( $startfrom - 1 ) * $resultsperpage + 1; >diff --git a/serials/subscription-bib-search.pl b/serials/subscription-bib-search.pl >index 8e44603..6e425a5 100755 >--- a/serials/subscription-bib-search.pl >+++ b/serials/subscription-bib-search.pl >@@ -99,7 +99,7 @@ if ( $op eq "do_search" && $query ) { > $resultsperpage = $input->param('resultsperpage'); > $resultsperpage = 20 if ( !defined $resultsperpage ); > >- my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); >+ my $searcher = Koha::SearchEngine::Search->new({index => Koha::SearchEngine::BIBLIOS_INDEX}); > my ( $error, $marcrecords, $total_hits ) = > $searcher->simple_search_compat( $query, $startfrom * $resultsperpage, $resultsperpage ); > my $total = 0; >-- >2.1.4
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 16588
:
53636
|
53637
|
53638
|
54477
|
55934
|
55935
|
55936
|
55937
|
56853
|
57516
|
57517
|
57518
|
57519
|
73444
|
73445
|
73446
|
73447
|
73448
|
73449
|
73450
|
73451
|
73452