我有一个自定义FullTextSqlQuery
用于检索某些特定页面。
该查询包含多个FREETEXT
谓词并提供不可用的排名,这是根据MSDN的预期行为,查询应仅包含一个FREETEXT
给出预期结果的基本查询是
SELECT Title, ACLanguage, ACContent, ACCategory, ACKeywords, ACID
FROM scope()
WHERE (FREETEXT(Title,'text') OR FREETEXT(ACContent, 'text') OR FREETEXT(ACSubtitle, 'text'))
documentation表示可以使用组别名重写此查询以使用单个谓词,但它不清楚语法。我尝试了以下结尾的多个语句:
SELECT Title, ACLanguage, ACContent, ACCategory, ACKeywords, ACID
FROM scope()
WHERE WITH(Title, ACSubtitle, ACContent) AS #SearchColumns FREETEXT(#SearchColumns,'text')
但我的所有尝试都以QueryMalformedException
如何编写此查询?
答案 0 :(得分:0)
指定多个列,如下所示:
SELECT Title, ACLanguage, ACContent, ACCategory, ACKeywords, ACID
FROM scope()
WHERE (FREETEXT((Title,ACContent,ACSubtitle),'text'))
或者,搜索所有全文索引列的简写:
SELECT Title, ACLanguage, ACContent, ACCategory, ACKeywords, ACID
FROM scope()
WHERE (FREETEXT(*,'text'))
(source)