Contextual search not working with alternate accessing mapping

 

Background

In our project, we are exposing the same SharePoint farms both outside and inside the company firewalls. For this, we are using Alternate Access Mapping (AAM) with a setup like this:

Zone Url Purpose
Default https://team.example.com Internal users and crawling
External https://team.example.com External users

IMPORTANT NOTE: A dedicated services farm was used for crawling the team sites. As we later understood, it otherwise would have worked. Read on the see why.

 

Problem

In this scenario, the contextual search features, e.g. “This Site” and “This list” don’t work when accessing the site externally. The users never got any results:

https - no results

But the user who accessed via the “Default” zone got results:

http - results

And, importantly, the external users got search results if the search via the “Search Center”. It was only the contextual search which failed.

 

Solution

With help from my colleague, Jon Waite, I understood that the problem is due to the dedicated services farm not being aware of the AAM settings on the farm that is crawled. Fortunately, SharePoint has provided an easy solution for giving the crawling farm a hint about this, via “External Resource Mapping”. This is the one link under “Alternate Access Mapping” which I previous never understood the purpose of:

Map to external resource

If you click on this link, you get a description which is partly misleading:

External resource mapping

It says it can be used for mapping “a resource outside of SharePoint”. More correct would be to say “outside this SharePoint farm”, i.e., on a remote farm, which is exactly what we need. To use it, we fill in values as in the example above, click “Save”. Then click “Add Internal URLs”, where we specify the “Extranet” URL. Again, somewhat confusing naming. The end result should look like this:

team mapping

And that’s all you need to do! No recrawl or other updates are needed. I love it when things just work! Smilefjes