summaryrefslogtreecommitdiff
path: root/include/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php
index 963018858..6dc9990e8 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1486,11 +1486,19 @@
}
if (count($search_query_leftover) > 0) {
- $search_query_leftover = $pdo->quote(implode(" & ", $search_query_leftover));
if (DB_TYPE == "pgsql") {
+
+ // if there's no joiners consider this a "simple" search and
+ // concatenate everything with &, otherwise don't try to mess with tsquery syntax
+ if (preg_match("/[&|]/", implode(" " , $search_query_leftover))) {
+ $tsquery = $pdo->quote(implode(" ", $search_query_leftover));
+ } else {
+ $tsquery = $pdo->quote(implode(" & ", $search_query_leftover));
+ }
+
array_push($query_keywords,
- "(tsvector_combined @@ to_tsquery($search_language, $search_query_leftover))");
+ "(tsvector_combined @@ to_tsquery($search_language, $tsquery))");
}
}