【发布时间】:2015-08-24 04:48:12
【问题描述】:
我正在构建一个 laravel 项目搜索字段,我在其中使用全文搜索。我已经设法让它工作,但我无法同时搜索多个关键字。
例子:
我有一个值为one two three four 的行,如果我搜索two three,它会找到其中包含two 或three 的所有条目。但我希望它同时找到two 和three 的条目
SQL 查询:
DB::raw("select id, name, text, image, publishDate from game
where match (name) AGAINST ('*$searchphrase*' IN BOOLEAN MODE) LIMIT 5")
【问题讨论】:
-
或者最终如果可以对其进行排序,以便包含两个关键字的短语列在顶部。
标签: php mysql laravel search full-text-search