Join subqueries as OR'd groups in QueryParser
authorThomas Berezansky <tsbere@mvlc.org>
Tue, 14 Aug 2012 17:31:27 +0000 (13:31 -0400)
committerDan Scott <dscott@laurentian.ca>
Thu, 16 Aug 2012 03:13:34 +0000 (23:13 -0400)
This makes filter_group_entry(1,2,3) build an OR'd set of the resulting
queries instead of just tacking them onto each other as ANDs.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Dan Scott <dscott@laurentian.ca>

Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index 669bf20..cbfd99c 100644 (file)
@@ -13,15 +13,17 @@ 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 })
-        }
+    return sprintf(' ((%s)) ',
+        join(
+            ') || (',
+            map {
+                $_->query_text
+            } @{
+                OpenILS::Utils::CStoreEditor
+                    ->new
+                    ->search_actor_search_query({ id => $params })
+            }
+        )
     );
 }