我有一个产品表,想在 Tag 列上进行搜索,结果必须按单词出现的次数进行排序。
ID | Tag
---------------------------------------
1 | LG television
2 | BOSCH vacuum cleaner 55 mm
3 | SONY home theater 55 watt
---------------------------------------
要搜索的字符串: LG 55真空影院之家
所需结果:
1. SONY home theater 55 watt (contains three words: 55,theater,home)
2. BOSCH vacuum cleaner 55 mm (contains two words: 55,vacuum)
3. LG television (contains one word: LG)
Find string according to words count中有一个使用 Like 且非常慢的解决方案。
我想通过全文搜索
实施它更新:我尝试了以下解决方案,但结果不正确
SELECT ft.[Rank], p.Tag
FROM tblProducts AS p
INNER JOIN FREETEXTTABLE(tblProducts, Tag, 'LG 55 vacuum theater home') AS ft
ON ft.[Key] = p.ProductID
ORDER BY ft.[Rank] DESC;