LP#1839684: avoid repeating qtype prefix in query
authorJeff Davis <jeff.davis@bc.libraries.coop>
Mon, 9 Sep 2019 23:11:44 +0000 (16:11 -0700)
committerMike Rylander <mrylander@gmail.com>
Fri, 21 Feb 2020 19:28:39 +0000 (14:28 -0500)
Signed-off-by: Jeff Davis <jeff.davis@bc.libraries.coop>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Gina Monti <gmonti@biblio.org>

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm

index c21566a..459e308 100644 (file)
@@ -67,7 +67,7 @@ sub _prepare_biblio_search_basics {
             $query = "bib_level(s) $query";
         }
 
-        $query = "$qtype:$query" unless $qtype eq 'keyword' and $i == 0;
+        $query = "$qtype:$query" unless ($query =~ /^$qtype:/ or ($qtype eq 'keyword' and $i == 0));
 
         $bool = ($bool and $bool eq 'or') ? '||' : '&&';
         $full_query = $full_query ? "($full_query $bool $query)" : $query;