开发者

Sharepoint Object Model vs WebServices

开发者 https://www.devze.com 2023-01-29 02:32 出处:网络
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

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开发者_如何学C>                        
<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();


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消