Bug 9239: Allow the use of QueryParser for all queries
[koha.git] / cataloguing / value_builder / marc21_linking_section.pl
index f317f8b..f30086e 100644 (file)
@@ -190,7 +190,15 @@ sub plugin {
            my $startfrom      = $query->param('startfrom');
                my $resultsperpage = $query->param('resultsperpage') || 20;
             my $orderby;
-           $search = 'kw,wrdl=' . $search . ' and mc-itemtype=' . $itype if $itype;
+            my $QParser;
+            $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
+            my $op;
+            if ($QParser) {
+                $op = '&&';
+            } else {
+                $op = 'and';
+            }
+           $search = 'kw:' . $search . " $op mc-itemtype:" . $itype if $itype;
                my ( $errors, $results, $total_hits ) =
                   SimpleSearch( $search, $startfrom * $resultsperpage,
                  $resultsperpage );