none
Search REST API + AAM RRS feed

  • Question

  • I'm using multiple host named site collections - one for each of our subsidiary's websites.  Each has a default and internet URL assigned use set-spsiteurl (AAM's).  I'm using the search REST api to generate some dynamic pages.  I'm trying to figure out how to get the REST API to apply the AAM so that the returned url's use the proper URL?  I always get result paths based upon the default AAM.  There must be a way to have search take the AAM from the query URL and apply the proper rules to give me valid result URLs.  The Content Search web part does this properly.

    Ray Riopel

    Friday, November 20, 2015 2:04 AM

All replies

  • Hi Ray,

    Per my understanding, you configured two zones for your host named site collections, you want to get the corresponding result URL using Search REST API based on the current zone.

    Seems there no such property in Search REST API can meet this requirement, a thought is that, you might need to get the relative URL from the search result retrieved from the Search API firstly, then generate the corresponding URL based on the current zone in the code behind.

    Thanks,               

    Patrick Liang


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

    Monday, November 23, 2015 9:46 AM
    Moderator
  • Thanks Patrick.  I was hoping to avoid hard coding the AAM rules in my Javascript but I guess I'll have to do that.

    Ray Riopel

    Monday, November 23, 2015 1:20 PM
  • I've discovered more details.  The Search REST API handles AAM rules correctly when the user is authenticated.  It does not for anonymous users.  It's almost like it's ignoring the QueryTemplateProperties.  I've noticed that I get back all properties, not just the ones I've specified in SelectProperties.

    Ray Riopel

    Thursday, November 26, 2015 2:25 PM