Bug 16660 - Elasticsearch broken if OpacSuppression is activated
Summary: Elasticsearch broken if OpacSuppression is activated
Status: Pushed to Master
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Srdjan Jankovic
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 12478
Blocks:
  Show dependency treegraph
 
Reported: 2016-06-04 08:21 UTC by Katrin Fischer
Modified: 2017-10-27 17:12 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 16660: Moved Opac Supression filtering from opac-search.pl to Zebra::QueryBuilder (4.77 KB, patch)
2017-02-28 02:24 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
Bug 16660: Moved Opac Supression filtering from opac-search.pl to Zebra::QueryBuilder (4.83 KB, patch)
2017-10-17 20:21 UTC, David Bourgault
Details | Diff | Splinter Review
Bug 16660 - Add support for OpacSuppression to Elasticsearch (2.03 KB, patch)
2017-10-18 21:02 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 16660: Moved Opac Supression filtering from opac-search.pl to Zebra::QueryBuilder (4.90 KB, patch)
2017-10-20 14:23 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16660: Add support for OpacSuppression to Elasticsearch (2.10 KB, patch)
2017-10-20 14:24 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16660: (followup) Unit tests (7.65 KB, patch)
2017-10-20 14:24 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16660: Moved Opac Supression filtering from opac-search.pl to Zebra::QueryBuilder (4.94 KB, patch)
2017-10-27 13:34 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 16660: Add support for OpacSuppression to Elasticsearch (2.14 KB, patch)
2017-10-27 13:34 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 16660: (followup) Unit tests (7.68 KB, patch)
2017-10-27 13:34 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2016-06-04 08:21:15 UTC
When OpacSuppression is active, you can't search using Elasticsearch. The error shown is:
Unable to perform your search. Please try again. 

By adding a die we coaxed it into a better error message:
Can't use string ("(HASH(0xcfe2548)) not Suppress=1") as a HASH ref while "strict refs" in use at /home/katrin/kohaclone/Koha/SearchEngine/Elasticsearch/Search.pm line 99.
Comment 1 Srdjan Jankovic 2017-02-28 02:24:07 UTC
Created attachment 60727 [details] [review]
Bug 16660: Moved Opac Supression filtering from opac-search.pl to Zebra::QueryBuilder

To test:
OPAC: Both SearchEngine "Elasticsearch" and "Zebra" should work with
OpacSuppression set to "yes"

NB: OPAC suppression is not implemented for Elasticsearch
Comment 2 Claire Gravely 2017-03-22 15:14:35 UTC
I still get the same "unable to perform your search" error for elasticsearch even with patch applied.
Comment 3 Srdjan Jankovic 2017-03-23 02:04:01 UTC
Hi Claire,
Can you please have a look at https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18189 , I believe you are experiencing the same thing.
Comment 4 Srdjan Jankovic 2017-03-23 02:06:04 UTC
Actually that was nonsense. Is your search engine set to Zebra please?
Comment 5 Claire Gravely 2017-03-23 08:17:28 UTC
(In reply to Srdjan Jankovic from comment #4)
> Actually that was nonsense. Is your search engine set to Zebra please?

It was set to elasticsearch and I had turned on the OpacSuppression preference for testing. 

Without this system preference the search was working with no error message.
Comment 6 Srdjan Jankovic 2017-03-28 00:58:32 UTC
Claire, would you be able to have a look at the log file and tell me what is the error please?
Comment 7 Frank Hansen 2017-09-22 12:03:46 UTC
We are experiencing the same problem. Here is the error we get:

Can't use string ("(HASH(0x55fc9bc7b880)) not Suppr"...) as a HASH ref while "strict refs" in use at /usr/local/koha/Koha/SearchEngine/Elasticsearch/Search.pm line 100.
 at /usr/local/koha/circ/returns.pl line 36.
        CGI::Compile::ROOT::usr_local_koha_circ_returns_2epl::__ANON__("Can't use string (\"(HASH(0x55fc9bc7b880)) not Suppr\"...) as a"...) called at /usr/local/koha/Koha/SearchEngine/Elasticsearch/Search.pm line 100
        eval {...} called at /usr/local/koha/Koha/SearchEngine/Elasticsearch/Search.pm line 99
        Koha::SearchEngine::Elasticsearch::Search::search(Koha::SearchEngine::Elasticsearch::Search=HASH(0x55fc9b9f1e10), "(HASH(0x55fc9bc7b880)) not Suppress=1", undef, 20, "offset", 0, "expanded_facet", undef) called at /usr/local/koha/Ko
ha/SearchEngine/Elasticsearch/Search.pm line 154
        Koha::SearchEngine::Elasticsearch::Search::search_compat(Koha::SearchEngine::Elasticsearch::Search=HASH(0x55fc9b9f1e10), "(HASH(0x55fc9bc7b880)) not Suppress=1", "hamlet, kronborg", ARRAY(0x55fc99192378), ARRAY(0x55fc99988690), 20,
0, undef, ...) called at /usr/local/koha/opac/opac-search.pl line 616
        eval {...} called at /usr/local/koha/opac/opac-search.pl line 615
        eval {...} called at /usr/local/koha/opac/opac-search.pl line 2
        CGI::Compile::ROOT::usr_local_koha_opac_opac_2dsearch_2epl::__ANON__(CGI::Compile=HASH(0x55fc974af3c0), "", "/usr/local/koha/opac/opac-search.pl", "/usr/local/koha/opac", ARRAY(0x55fc9be6db90)) called at /usr/local/share/perl/5.24.1
/CGI/Compile.pm line 139
        CGI::Compile::__ANON__() called at /usr/local/share/perl/5.24.1/CGI/Emulate/PSGI.pm line 30
        CGI::Emulate::PSGI::__ANON__(HASH(0x55fc9ba4ba30)) called at /usr/local/share/perl/5.24.1/Plack/App/WrapCGI.pm line 90
        Plack::App::WrapCGI::call(Plack::App::WrapCGI=HASH(0x55fc991463f8), HASH(0x55fc9ba4ba30)) called at /usr/local/share/perl/5.24.1/Plack/Component.pm line 50
        Plack::Component::__ANON__(HASH(0x55fc9ba4ba30)) called at /usr/local/share/perl/5.24.1/Plack/App/CGIBin.pm line 50
        Plack::App::CGIBin::serve_path(Plack::App::CGIBin=HASH(0x55fc96114c18), HASH(0x55fc9ba4ba30), "/usr/local/koha/opac/opac-search.pl") called at /usr/local/share/perl/5.24.1/Plack/App/File.pm line 34
        Plack::App::File::call(Plack::App::CGIBin=HASH(0x55fc96114c18), HASH(0x55fc9ba4ba30)) called at /usr/local/share/perl/5.24.1/Plack/Component.pm line 50
        Plack::Component::__ANON__(HASH(0x55fc9ba4ba30)) called at /usr/local/share/perl/5.24.1/Plack/App/URLMap.pm line 71
        Plack::App::URLMap::call(Plack::App::URLMap=HASH(0x55fc96114d20), HASH(0x55fc9ba4ba30)) called at /usr/local/share/perl/5.24.1/Plack/Component.pm line 50
        Plack::Component::__ANON__(HASH(0x55fc9ba4ba30)) called at /usr/local/koha/Koha/Middleware/SetEnv.pm line 103
        Koha::Middleware::SetEnv::call(Koha::Middleware::SetEnv=HASH(0x55fc97227fa8), HASH(0x55fc9b690658)) called at /usr/local/share/perl/5.24.1/Plack/Component.pm line 50
        Plack::Component::__ANON__(HASH(0x55fc9b690658)) called at /usr/local/share/perl/5.24.1/Plack/Middleware/Static.pm line 18
        Plack::Middleware::Static::call(Plack::Middleware::Static=HASH(0x55fc97228248), HASH(0x55fc9b690658)) called at /usr/local/share/perl/5.24.1/Plack/Component.pm line 50
        Plack::Component::__ANON__(HASH(0x55fc9b690658)) called at /usr/local/share/perl/5.24.1/Plack/Middleware/ReverseProxy.pm line 68
        Plack::Middleware::ReverseProxy::call(Plack::Middleware::ReverseProxy=HASH(0x55fc972284d0), HASH(0x55fc9b690658)) called at /usr/local/share/perl/5.24.1/Plack/Component.pm line 50
        Plack::Component::__ANON__(HASH(0x55fc9b690658)) called at /usr/local/share/perl/5.24.1/Plack/Middleware/AccessLog.pm line 27
        Plack::Middleware::AccessLog::call(Plack::Middleware::AccessLog=HASH(0x55fc8e5ac3f8), HASH(0x55fc9b690658)) called at /usr/local/share/perl/5.24.1/Plack/Component.pm line 50
        Plack::Component::__ANON__(HASH(0x55fc9b690658)) called at /usr/local/share/perl/5.24.1/Plack/Util.pm line 145
        eval {...} called at /usr/local/share/perl/5.24.1/Plack/Util.pm line 145
        Plack::Util::run_app(CODE(0x55fc8e5acde8), HASH(0x55fc9b690658)) called at /usr/share/perl5/Starman/Server.pm line 195
        Starman::Server::dispatch_request(Starman::Server=HASH(0x55fc8df42128), HASH(0x55fc9b690658)) called at /usr/share/perl5/Starman/Server.pm line 298
        Starman::Server::process_request(Starman::Server=HASH(0x55fc8df42128), Net::Server::Proto::UNIX=GLOB(0x55fc9bb2db20)) called at /usr/local/share/perl/5.24.1/Net/Server.pm line 72
        Net::Server::run_client_connection(Starman::Server=HASH(0x55fc8df42128)) called at /usr/local/share/perl/5.24.1/Net/Server/PreFork.pm line 225
        eval {...} called at /usr/local/share/perl/5.24.1/Net/Server/PreFork.pm line 225
        Net::Server::PreFork::run_child(Starman::Server=HASH(0x55fc8df42128)) called at /usr/local/share/perl/5.24.1/Net/Server/PreFork.pm line 183
        Net::Server::PreFork::run_n_children(Starman::Server=HASH(0x55fc8df42128), 1) called at /usr/local/share/perl/5.24.1/Net/Server/PreFork.pm line 373
        Net::Server::PreFork::coordinate_children(Starman::Server=HASH(0x55fc8df42128)) called at /usr/local/share/perl/5.24.1/Net/Server/PreFork.pm line 327
        Net::Server::PreFork::run_parent(Starman::Server=HASH(0x55fc8df42128)) called at /usr/share/perl5/Starman/Server.pm line 164
        Starman::Server::run_parent(Starman::Server=HASH(0x55fc8df42128)) called at /usr/local/share/perl/5.24.1/Net/Server/PreFork.pm line 109
        Net::Server::PreFork::loop(Starman::Server=HASH(0x55fc8df42128)) called at /usr/local/share/perl/5.24.1/Net/Server.pm line 58
        Net::Server::run(Starman::Server=HASH(0x55fc8df42128), "port", ARRAY(0x55fc8e4db780), "host", "*", "proto", "tcp", "serialize", ...) called at /usr/share/perl5/Starman/Server.pm line 106
        Starman::Server::run(Starman::Server=HASH(0x55fc8df42128), CODE(0x55fc8df41ff0), HASH(0x55fc8df41db0)) called at /usr/share/perl5/Plack/Handler/Starman.pm line 25
        Plack::Handler::Starman::run(Plack::Handler::Starman=HASH(0x55fc8df42008), CODE(0x55fc8df41ff0)) called at /usr/local/share/perl/5.24.1/Plack/Loader/Delayed.pm line 20
        Plack::Loader::Delayed::run(Plack::Loader::Delayed=HASH(0x55fc8dd79678), Plack::Handler::Starman=HASH(0x55fc8df42008)) called at /usr/local/share/perl/5.24.1/Plack/Runner.pm line 277
        Plack::Runner::run(Plack::Runner=HASH(0x55fc8dd0c378)) called at /usr/bin/starman line 38

Is someone looking into this?
Comment 8 Srdjan Jankovic 2017-09-26 02:20:33 UTC
Hi Frank,
When I apply the patch I don't get the error. Are you positive you have the patch applied please?
Comment 9 Frank Hansen 2017-09-26 12:34:16 UTC
(In reply to Srdjan Jankovic from comment #8)
> Hi Frank,
> When I apply the patch I don't get the error. Are you positive you have the
> patch applied please?

Thank's, the patch works for me.
Comment 10 David Bourgault 2017-10-17 20:21:17 UTC
Created attachment 68224 [details] [review]
Bug 16660: Moved Opac Supression filtering from opac-search.pl to Zebra::QueryBuilder

To test:
OPAC: Both SearchEngine "Elasticsearch" and "Zebra" should work with
OpacSuppression set to "yes"

NB: OPAC suppression is not implemented for Elasticsearch

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Comment 11 Nick Clemens 2017-10-18 21:02:33 UTC
Created attachment 68280 [details] [review]
Bug 16660 - Add support for OpacSuppression to Elasticsearch

To test:
1 - Enable suppression
2 - Suppress some records
3 - Apply all the patches
4 - Reindex ES
5 - Search and don't get suppressed records
6 - Disable suppression
7 - Search and get all the records
Comment 12 Tomás Cohen Arazi 2017-10-20 14:23:54 UTC
Created attachment 68320 [details] [review]
Bug 16660: Moved Opac Supression filtering from opac-search.pl to Zebra::QueryBuilder

To test:
OPAC: Both SearchEngine "Elasticsearch" and "Zebra" should work with
OpacSuppression set to "yes"

NB: OPAC suppression is not implemented for Elasticsearch

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 13 Tomás Cohen Arazi 2017-10-20 14:24:05 UTC
Created attachment 68321 [details] [review]
Bug 16660: Add support for OpacSuppression to Elasticsearch

To test:
1 - Enable suppression
2 - Suppress some records
3 - Apply all the patches
4 - Reindex ES
5 - Search and don't get suppressed records
6 - Disable suppression
7 - Search and get all the records

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 14 Tomás Cohen Arazi 2017-10-20 14:24:14 UTC
Created attachment 68322 [details] [review]
Bug 16660: (followup) Unit tests

This patch adds unit tests for the introduced changes in
build_query_compat.

It removes a warning too.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 15 Kyle M Hall 2017-10-27 13:34:08 UTC
Created attachment 68704 [details] [review]
Bug 16660: Moved Opac Supression filtering from opac-search.pl to Zebra::QueryBuilder

To test:
OPAC: Both SearchEngine "Elasticsearch" and "Zebra" should work with
OpacSuppression set to "yes"

NB: OPAC suppression is not implemented for Elasticsearch

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 16 Kyle M Hall 2017-10-27 13:34:15 UTC
Created attachment 68705 [details] [review]
Bug 16660: Add support for OpacSuppression to Elasticsearch

To test:
1 - Enable suppression
2 - Suppress some records
3 - Apply all the patches
4 - Reindex ES
5 - Search and don't get suppressed records
6 - Disable suppression
7 - Search and get all the records

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 17 Kyle M Hall 2017-10-27 13:34:18 UTC
Created attachment 68706 [details] [review]
Bug 16660: (followup) Unit tests

This patch adds unit tests for the introduced changes in
build_query_compat.

It removes a warning too.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 18 Jonathan Druart 2017-10-27 17:12:49 UTC
Pushed to master for 17.11, thanks to everybody involved!