Sharepoint 对象模型与 Web 服务

发布于 2024-10-05 22:12:41 字数 2141 浏览 9 评论 0原文

我创建了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放飞的风筝 2024-10-12 22:12:41

您至少需要添加:

ftq.EnableStemming = false;
ftq.TrimDuplicates = true;
ftq.IgnoreAllNoiseQuery = true;
ftq.KeywordInclusion = KeywordInclusion.AllKeywords;

至少对两种方法进行公平的比较。那么,您还可以尝试:

ftq.AuthenticationType = QueryAuthenticationType.PluggableAuthenticatedQuery;

You need at least to add:

ftq.EnableStemming = false;
ftq.TrimDuplicates = true;
ftq.IgnoreAllNoiseQuery = true;
ftq.KeywordInclusion = KeywordInclusion.AllKeywords;

to at least make a fair comparison between the two methods. Then, you can also try:

ftq.AuthenticationType = QueryAuthenticationType.PluggableAuthenticatedQuery;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文