Sharepoint 对象模型与 Web 服务
我创建了一个 xml 查询,并将其发送到我的 sharepoint 搜索服务,该服务返回一些结果。然后我从中取出 SQL 查询文本并开始将其与对象模型一起使用,但现在它不起作用。根据下面的代码,我看起来像是做错了什么吗?
查询 XML(返回结果):
<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000">
<Query domain="QDomain">
<SupportedFormats><Format>urn:Microsoft.Search.Response.Document.Document</Format></SupportedFormats>
<Context>
<QueryText language="en-US" type="MSSQLFT"><![CDATA[ SELECT Title, Rank, owsPublished1,owsSocialx0020Networkx0020Update, Description, Write, Path FROM scope() ORDER BY "Rank" DESC ]]></QueryText>
</Context>
<Range><StartAt>1</StartAt><Count>20</Count></Range>
<EnableStemming>false</EnableStemming>
<TrimDuplicates>true</TrimDuplicates>
<IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery>
<ImplicitAndBehavior>true</ImplicitAndBehavior> <IncludeRelevanceResults>true</IncludeRelevanceResults> <IncludeSpecialTermResults>true</IncludeSpecialTermResults>
<IncludeHighConfidenceResults>true</IncludeHighConfidenceResults>
</Query></QueryPacket>
对象模型代码(不返回):
SPSite site = new SPSite("http://sp-dev/");
ServerContext sc = ServerContext.GetContext(site);
FullTextSqlQuery ftq = new FullTextSqlQuery(sc);
string querySQL = @"SELECT Title, Rank, owsPublished1,owsSocialx0020Networkx0020Update, Description, Write, Path FROM scope() ORDER BY ""Rank"" DESC ";
ftq.QueryText = querySQL;;
ResultTableCollection results = ftq.Execute();
I had created a xml query that I was sending to my sharepoint search service which was returning some results. I then pulled the SQL query text out of it and started using it with the object model and now it's not working. Does it look like I am doing something wrong based on the code below?
Query XML (returns results):
<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000">
<Query domain="QDomain">
<SupportedFormats><Format>urn:Microsoft.Search.Response.Document.Document</Format></SupportedFormats>
<Context>
<QueryText language="en-US" type="MSSQLFT"><![CDATA[ SELECT Title, Rank, owsPublished1,owsSocialx0020Networkx0020Update, Description, Write, Path FROM scope() ORDER BY "Rank" DESC ]]></QueryText>
</Context>
<Range><StartAt>1</StartAt><Count>20</Count></Range>
<EnableStemming>false</EnableStemming>
<TrimDuplicates>true</TrimDuplicates>
<IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery>
<ImplicitAndBehavior>true</ImplicitAndBehavior> <IncludeRelevanceResults>true</IncludeRelevanceResults> <IncludeSpecialTermResults>true</IncludeSpecialTermResults>
<IncludeHighConfidenceResults>true</IncludeHighConfidenceResults>
</Query></QueryPacket>
Object model code (doesn't):
SPSite site = new SPSite("http://sp-dev/");
ServerContext sc = ServerContext.GetContext(site);
FullTextSqlQuery ftq = new FullTextSqlQuery(sc);
string querySQL = @"SELECT Title, Rank, owsPublished1,owsSocialx0020Networkx0020Update, Description, Write, Path FROM scope() ORDER BY ""Rank"" DESC ";
ftq.QueryText = querySQL;;
ResultTableCollection results = ftq.Execute();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您至少需要添加:
至少对两种方法进行公平的比较。那么,您还可以尝试:
You need at least to add:
to at least make a fair comparison between the two methods. Then, you can also try: