我有一个以 id,主题,描述,图片网址作为列的表格。 像
这样的条目id topic description image_url
1 People and blogs TownHall http://...
2 People and blogs 2 ...... .......
3 Blogs ....... .......
4 Good ...... ......
当我将博客搜索为查询输入时
SELECT * FROM people
WHERE MATCH(topic,descript) AGAINST ("blogs" WITH QUERY EXPANSION)
我的结果是
1 People and blogs TownHall http://.../
2 People and blogs 2 ...... ......./
3 Blogs ....... ......./
第三行应该是第一行,因为它是确切的词(博客),其余的行应该在此之后...
请帮我调试一下。
答案 0 :(得分:0)
尝试类似:
{{link-to}}
答案 1 :(得分:0)
尝试以下SQL,它将解决您的问题。
SELECT people.*
FROM people
order by MATCH(topic,descript) AGAINST ("blogs" WITH QUERY EXPANSION) asc;
输出:
+------+--------------------+-------------+
| id | topic | descript |
+------+--------------------+-------------+
| 3 | Blogs | ........ |
| 2 | People and blogs 2 | ........ |
| 1 | People and blogs | TownHall |
+------+--------------------+-------------+