按Rank排序的S​​QL SELECT FREETEXT

时间:2013-07-01 19:02:16

标签: sql sql-server freetext

我在SQL Server 2008中有这个查询

SELECT TOP 1000 * 
FROM Quotes 
INNER JOIN QuoteImages ON Quotes.Id = QuoteImages.QuoteId 
WHERE FREETEXT(QuoteText,'some text')

如何按最相关或最高级别排序结果?

我已经阅读了msdn文档,但它似乎很复杂,我不知道如何创建复杂的存储过程。

1 个答案:

答案 0 :(得分:12)

您应该使用FREETEXTTABLElink)代替FREETEXT

SELECT TOP 1000 Q.*, QI.*
FROM Quotes Q
INNER JOIN QuoteImages QI
    ON Q.Id = QI.QuoteId 
INNER JOIN FREETEXTTABLE(Quotes,QuoteText,'some text') FT
    ON Q.Id = FT.[Key]
ORDER BY RANK DESC