Search hashtags via word index (#655)

This commit is contained in:
celestora 2022-08-15 09:08:07 +03:00 committed by GitHub
parent b117d0fe01
commit d02cef93ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -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);

View file

@ -0,0 +1 @@
ALTER TABLE `posts` ADD FULLTEXT `content` (`content`);