implement native fulltext search on mysql

This commit is contained in:
Andrew Dolgov 2022-06-19 22:21:54 +03:00
parent 6d98cc6c80
commit 50f014e52d
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
1 changed files with 10 additions and 3 deletions

View File

@ -2357,8 +2357,11 @@ class Feeds extends Handler_Protected {
$k = mb_strtolower($k); $k = mb_strtolower($k);
array_push($search_query_leftover, $not ? "!$k" : $k); array_push($search_query_leftover, $not ? "!$k" : $k);
} else { } else {
array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") $k = mb_strtolower($k);
OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); array_push($search_query_leftover, $not ? "-$k" : $k);
//array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
// OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
} }
if (!$not) array_push($search_words, $k); if (!$not) array_push($search_words, $k);
@ -2380,8 +2383,12 @@ class Feeds extends Handler_Protected {
array_push($query_keywords, array_push($query_keywords,
"(tsvector_combined @@ to_tsquery($search_language, $tsquery))"); "(tsvector_combined @@ to_tsquery($search_language, $tsquery))");
} } else {
$ft_query = $pdo->quote(implode(" ", $search_query_leftover));
array_push($query_keywords,
"MATCH (ttrss_entries.title, ttrss_entries.content) AGAINST ($ft_query IN BOOLEAN MODE)");
}
} }
if (count($query_keywords) > 0) if (count($query_keywords) > 0)