【发布时间】:2010-03-04 23:09:01
【问题描述】:
查询 #1:
SELECT DISTINCT `title`
FROM `table`
WHERE (
`title` LIKE '%this is search%'
)
OR (
`title` LIKE '%this%'
AND `title` LIKE '%is%'
AND `title` LIKE '%search%'
)
OR (
`title` LIKE '%this%'
OR `title` LIKE '%is%'
OR `title` LIKE '%search%'
)
LIMIT 0 , 10
但效果不佳,当我尝试拆分此 sql 时:
查询 #2:
SELECT DISTINCT `title`
FROM `table`
WHERE (
`title
` LIKE '%this is search%'
)
或
查询 #3:
SELECT DISTINCT `title`
FROM `table`
WHERE (
`title` LIKE '%this%'
AND `title` LIKE '%is%'
AND `title` LIKE '%search%'
或等...
返回不同的结果
【问题讨论】:
-
您的实际问题是什么?请详细说明。
-
我的问题是如何在没有全文搜索的情况下获得最佳搜索结果
-
最佳搜索结果是指与搜索最相似还是返回的结果最多?我也对你在这里想要什么感到困惑。
-
是的,你想要一个精确的字符串匹配,它必须包含所有单词,还是在多单词搜索中单个单词匹配就足够了?使用自然语言搜索具有提供分数列的好处,因此按相关性排序更简单
标签: sql select search sql-like