LP 1160522 2.3 tpac search modifier query append
authorBill Erickson <berick@esilibrary.com>
Wed, 27 Mar 2013 20:26:28 +0000 (16:26 -0400)
committerBen Shum <bshum@biblio.org>
Mon, 1 Apr 2013 22:09:30 +0000 (18:09 -0400)
Append search modifiers (e.g. limit to available) to the end of the
tpac search query to avoid SQL generation issues with 2.3 series
query parser.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm

index c85a0bb..470426c 100644 (file)
@@ -61,10 +61,6 @@ sub _prepare_biblio_search {
 
     $query .= ' ' . $ctx->{global_search_filter} if $ctx->{global_search_filter};
 
-    foreach ($cgi->param('modifier')) {
-        # The unless bit is to avoid stacking modifiers.
-        $query = ('#' . $_ . ' ' . $query) unless $query =~ qr/\#\Q$_/;
-    }
 
     # filters
     foreach (grep /^fi:/, $cgi->param) {
@@ -168,6 +164,11 @@ sub _prepare_biblio_search {
         push @naive_query_re, $thing;
     }
 
+    foreach ($cgi->param('modifier')) {
+        # The unless bit is to avoid stacking modifiers.
+        $query .= " #$_" unless $query =~ qr/\#\Q$_/;
+    }
+
     # This gives templates a way to take site() and depth() back out of
     # query strings when they shouldn't be there (because they're controllable
     # with other widgets).