From e808d718a1104217a884ea2f353b9c1fec8ca101 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 18 Apr 2012 13:25:06 -0400 Subject: [PATCH] Give the PG QP driver a subquery callback for the new saved_query() filter Signed-off-by: Mike Rylander Signed-off-by: Bill Erickson --- .../Storage/Driver/Pg/QueryParser.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index 89e3c12a56..1bdbec7070 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -6,9 +6,24 @@ use OpenILS::Application::Storage::QueryParser; use base 'QueryParser'; use OpenSRF::Utils::JSON; use OpenILS::Application::AppUtils; +use OpenILS::Utils::CStoreEditor; my $U = 'OpenILS::Application::AppUtils'; my ${spc} = ' ' x 2; +sub subquery_callback { + my ($invocant, $self, $struct, $filter, $params, $negate) = @_; + + return join( + ' ', + map { + $_->query_text + } @{ + OpenILS::Utils::CStoreEditor + ->new + ->search_actor_search_query({ id => $params }) + } + ); +} sub quote_value { my $self = shift; @@ -412,6 +427,9 @@ sub TEST_SETUP { __PACKAGE__->default_search_class( 'keyword' ); +# implements EG-specific stored subqueries +__PACKAGE__->add_search_filter( 'saved_query', sub { return __PACKAGE__->subquery_callback(@_) } ); + # will be retained simply for back-compat __PACKAGE__->add_search_filter( 'format' ); -- 2.43.2