diff --git a/Web/Models/Repositories/Posts.php b/Web/Models/Repositories/Posts.php index 6dde27c8..7aadc0bb 100644 --- a/Web/Models/Repositories/Posts.php +++ b/Web/Models/Repositories/Posts.php @@ -71,7 +71,7 @@ class Posts { $hashtag = "#$hashtag"; $sel = $this->posts - ->where("content LIKE ?", "%$hashtag%") + ->where("MATCH (content) AGAINST (? IN BOOLEAN MODE)", "+$hashtag") ->where("deleted", 0) ->order("created DESC") ->page($page, $perPage ?? OPENVK_DEFAULT_PER_PAGE); diff --git a/install/sqls/00029-hashtag-search.sql b/install/sqls/00029-hashtag-search.sql new file mode 100644 index 00000000..9aa9618b --- /dev/null +++ b/install/sqls/00029-hashtag-search.sql @@ -0,0 +1 @@ +ALTER TABLE `posts` ADD FULLTEXT `content` (`content`); \ No newline at end of file