SharePoint FullTextSqlQuery使用多列搜索FREETEXT

时间:2014-05-21 09:11:04

标签: sharepoint full-text-search

我有一个自定义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

结束

如何编写此查询?

1 个答案:

答案 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