1
0
mirror of https://github.com/flarum/core.git synced 2025-10-17 17:56:14 +02:00

Merge branch 'master' into 1236-database-changes

This commit is contained in:
Daniel Klabbers
2018-06-19 09:57:47 +02:00
21 changed files with 84 additions and 124 deletions

View File

@@ -29,6 +29,10 @@ class FulltextGambit implements GambitInterface
throw new LogicException('This gambit can only be applied on a DiscussionSearch');
}
// The @ character crashes fulltext searches on InnoDB tables.
// See https://bugs.mysql.com/bug.php?id=74042
$bit = str_replace('@', '*', $bit);
$search->getQuery()
->selectRaw('SUBSTRING_INDEX(GROUP_CONCAT(posts.id ORDER BY MATCH(posts.content) AGAINST (?) DESC), \',\', 1) as most_relevant_post_id', [$bit])
->leftJoin('posts', 'posts.discussion_id', '=', 'discussions.id')