diff options
author | Andrew Dolgov <[email protected]> | 2022-06-19 22:21:54 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-06-19 22:21:54 +0300 |
commit | 50f014e52d0f90c71a95576c2414804eeaef131d (patch) | |
tree | ce3cbf4ff1793fad7f1284f698bab608da3981e5 /classes | |
parent | 6d98cc6c800ad2c2190c0ca8136db0aa814c634d (diff) |
implement native fulltext search on mysql
Diffstat (limited to 'classes')
-rwxr-xr-x | classes/feeds.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/classes/feeds.php b/classes/feeds.php index 197caeedc..ba3729375 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -2357,8 +2357,11 @@ class Feeds extends Handler_Protected { $k = mb_strtolower($k); array_push($search_query_leftover, $not ? "!$k" : $k); } else { - 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%")."))"); + $k = mb_strtolower($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); @@ -2380,8 +2383,12 @@ class Feeds extends Handler_Protected { array_push($query_keywords, "(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) |