mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 19:55:55 +00:00
better tsquery support:
1. report query syntax errors properly 2. fall back to implicit &-joining only if no joiners are detected in user query, otherwise permit full tsquery syntax
This commit is contained in:
@@ -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))");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user