none
Sharepoint Search Rest API Anonymous access to Promoted Results RRS feed

All replies

  • Hi,

    According to your post, my understanding is that you have an issue about the anonymous search rest api.

    You can check if there is a mismatch in the Site Collection or Web ID SharePoint 2013 Search which will fall back to the default Result Source.

    And if there is a mismatch in the configuration file and it might not be obvious at first that you’re getting results other than requested.

    It can be fixed fairly easy by including the correct Site Collection and Web ID’s in the configuration file.

    For more information: http://blog.mastykarz.nl/inconvenient-search-rest-api-anonymous-users/

    Thanks,

    Jason

    Forum Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Jason Guo
    TechNet Community Support

    Monday, September 29, 2014 9:56 AM
  • Thanks for the response. The sourceID I am getting is not my farm, site, or web ID, so you might be right. I read the article and don't seem to see where the sourceID is defined? Is it supposed to be the ID of the SITE or WEB? I have tried specifying it in the URL like in the article and still get a different one returned. I double checked them via powershell and they should be correct.

    Are there permission requirements of some kind in the web to allow this? I have anonymous permission enabled for the site.

    Tuesday, September 30, 2014 7:42 PM
  • Hi,

    Did you configure the FarmId, SiteId, WebId correctly in the configuration file?

    You can get the FarmId, SiteId and WebId with the below PowerShell.

    (Get-SPFarm).Id

    (Get-SPSite http://YourSiteURL).Id

    (Get-SPWeb http://YourSiteURL).Id

    Thanks,

    Jason

    Forum Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Jason Guo
    TechNet Community Support

    Wednesday, October 1, 2014 2:22 AM
  • Hi Matthew,

    Thanks for posting this issue, as you have already set your ProccessBestBets to True. then ideally you should get the Promoted Results in Search Resultant data.

    Now, checkout the query rules to get the Promoted Results. Kindly browse the below mentioned URL to implement the same step by step

    http://www.c-sharpcorner.com/UploadFile/40e97e/sharepoint-2013-how-to-promote-a-result-using-query-rules/

    http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/07/17/what-you-need-to-know-about-search-in-sharepoint-2013-preview.aspx

    I hope this is helpful to you. If this works, Please mark it as Answered.

    Regards,

    Dharmendra Singh (MCPD-EA | MCTS)

    Blog : http://sharepoint-community.net/profile/DharmendraSingh

    Wednesday, October 1, 2014 2:38 AM
  • As far as I can tell, I have those settings configured properly.

    But, I still see a different "SourceId".

    Like I said, it works perfectly (with promoted results) if I just login to sharepoint in the browser before I paste the API url. It appears to be a permissions issue, but I am not sure what.

    Wednesday, October 1, 2014 5:52 PM
  • Thanks, I do have the query rules configured with proper results if I am logged in. Its just when pasting in the same REST API url in a new browser without first logging in, that doesn't deliver the expected results.
    Wednesday, October 1, 2014 5:56 PM
  • It also works fine if I do an actual search from sharepoint even if I don't login.
    Wednesday, October 1, 2014 5:57 PM
  • I know this is an old post, but did you get to solve this issue? I am facing the same problem at the moment.
    Monday, October 19, 2015 7:47 PM
  • Unfortunately no. We opted to just expose a full sp search site to our anonymous site. It isn't perfect because depending on how people get there, they may or may not be logged in leading to non-standard results. 
    Friday, October 23, 2015 4:36 PM
  • We got it to work at my workplace. The problem, in our case, was with our querytemplate xml that had some wrong GUID's. As you have replied saying that this is not your problem, here is my request:

    $.ajax({
        url: "/_api/search/query?querytext='mykeyword'" +
        "&rowlimit=10&selectproperties='Title,Description,OriginalPath,HitHighlightedSummary'"+
        "&QueryTemplatePropertiesUrl='spfile://webroot/queryparametertemplate.xml'&sourceid='40f080a5-da63-4dce-b33a-fdad0dc83d1c'" +
        "&processbestbets=true&enablequeryrules=true",    
        headers: { "Accept": "application/json; odata=verbose"},
        success:function(data) {
        }
    });

    My promoted results were under the same place as when I was logged:

    SecondaryQueryResults > results > CustomResults > SpecialTermResults > Results > results

    This is my queryparametertemplate whitelist section:

      <WhiteList xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <a:string>RowLimit</a:string>
        <a:string>SortList</a:string>
        <a:string>StartRow</a:string>
        <a:string>RefinementFilters</a:string>
        <a:string>Culture</a:string>
        <a:string>RankingModelId</a:string>
        <a:string>TrimDuplicatesIncludeId</a:string>
        <a:string>ReorderingRules</a:string>
        <a:string>EnableQueryRules</a:string>    
        <a:string>HiddenConstraints</a:string>
        <a:string>QueryText</a:string>
        <a:string>QueryTemplate</a:string>
        <a:string>SelectProperties</a:string>
        <a:string>SourceID</a:string>
        <a:string>ProcessBestBets</a:string>
      </WhiteList>

    Wednesday, November 11, 2015 4:41 PM