我正在尝试运行FullTextSqlQuery。但我不断收到错误“您的查询格式错误”。关于是什么导致它破裂的任何想法?
FullTextSqlQuery sqlQuery = new FullTextSqlQuery(currentSite);
sqlQuery.ResultTypes = ResultType.RelevantResults;
sqlQuery.TrimDuplicates = true;
sqlQuery.StartRow = 1;
sqlQuery.RowLimit = int.MaxValue;
sqlQuery.HighlightedSentenceCount = 3;
sqlQuery.KeywordInclusion = KeywordInclusion.AnyKeyword;
sqlQuery.EnableStemming = true;
sqlQuery.SiteContext = new System.Uri(currentSite.Url);
sqlQuery.AuthenticationType = QueryAuthenticationType.PluggableAuthenticatedQuery;
//sqlQuery.QueryText = BuildFullTextSQLSearchString(keyword);
sqlQuery.QueryText = @"SELECT Title, Path, HitHighlightedSummary, Size, Rank, IsDocument, DocumentIcon, DocType, AuthInd, RequiresNDA, ProductLine, FileExtension
FROM portal..SCOPE()
WHERE CONTAINS('""test""') AND (""SCOPE"" = 'Software Downloads')
ORDER BY Rank DESC, Title ASC";
ResultTableCollection queryResults = sqlQuery.Execute();
答案 0 :(得分:1)
从查询中删除“Portal ..”解决了“您的查询格式错误”错误。
string fromClause =“FROM portal..SCOPE()”;
将rowlimit设置为int.MaxValue,导致抛出错误:这导致错误“HRESULT异常:0x80040E01”
sqlQuery.RowLimit = int.MaxValue;
从order by子句中删除“Title ASC”,防止出现错误“HRESULT异常:0x80040E60”。 串
orderByClause =“ORDER BY Rank DESC,Title ASC”;