Sql FREETEXTTABLE没有返回结果 [英] Sql FREETEXTTABLE not returning result
问题描述
我使用SQL FREETEXTTABLE根据用户输入的单词(如搜索引擎)搜索表格列并返回最佳匹配行。
表格列将包含许多问题,用户将在文本框中输入内容(按任意顺序),并根据他输入的内容自动填充搜索页面。
我使用了FREETEXTTABLE。但它在某些情况下不起作用。
我尝试过:
如果我输入'what'它不会返回任何内容。
Hi,
I have used SQL FREETEXTTABLE to search in a table column based on the user entered words like a search engine and return best matching rows.
Table column will contain many questions and user will type something in textbox (in any order) and based on what he has typed I need to auto populate the search page.
I have used FREETEXTTABLE for it. But its not working in some cases.
What I have tried:
If I type 'what' it does not return anything.
DECLARE @query VARCHAR(50) = 'what'
SELECT TOP 10 Questions
FROM tblQuestion tq INNER JOIN FREETEXTTABLE(tblQuestion, Questions, @query) ft
ON ( tq.ID = ft.[Key] )
ORDER BY ft.Rank DESC
但如果输入what is则返回10条记录。
but if I type 'what is' it returns the 10 records.
DECLARE @query VARCHAR(50) = 'what is'
SELECT TOP 10 Questions
FROM tblQuestion tq INNER JOIN FREETEXTTABLE(tblQuestion, Questions, @query) ft
ON ( tq.ID = ft.[Key] )
ORDER BY ft.Rank DESC
我也尝试过CONTAINS和FREETEXT。
I also tried CONTAINS and FREETEXT.
SELECT * FROM tblQuestion WHERE FREETEXT (Questions,'what')
即使这个查询返回零行。
但是下面的查询返回了几行。
Even this query returned zero rows.
But this below query returned few rows.
SELECT * FROM tblQuestion WHERE FREETEXT (Questions,'what is')
我希望它返回即使有用户输入的单词。
任何人都知道解决方案请帮助。
谢谢。
I want it to return even if there is single word typed by user.
Anyone knows the solution please help.
Thanks.
推荐答案
在sql服务中那里有一些单词的停止列表。
这是检查停止列表列表的查询
Hi ,
In sql server have a Some stoplist of words there.
Here is the query to check for list of stop lists
SELECT ssw.stopword, slg.name
FROM sys.fulltext_system_stopwords ssw
JOIN sys.fulltext_languages slg
ON slg.lcid = ssw.language_id
WHERE slg.lcid =1033
以下是更多细节的链接
停止单词列表。
您可以获得任何行的停止列表的Becoz。
谢谢
:)
Here is the link for more detail
stop words list .
Becoz of the stoplist you are getting any rows.
Thanks
:)
这篇关于Sql FREETEXTTABLE没有返回结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!