Retrieve the web URL for a search result via a managed property

October 09, 2014

These days a lot of my work is done in Office 365, but I have customers that are still working on an on-premises environment. Sometimes when switching back to an on-premises environment you could be surprised by things that are not (yet) available.

This week I wanted to implement a link which goes directly to the site on which the search result item is located. On Office 365 (SharePoint Online) used a managed property called SPWebURL to achieve this.

SharePoint Online - SPWebUrl property

SharePoint Online - SPWebUrl property

But when I wanted to use the managed property on the client its on-premises environment, I noticed that this managed property is not available.

Now the good news is that the ows_taxId_SPLocationSite crawled property is available on-premises, but it is not yet mapped to a managed property. So what you can do is create a new managed property and map it with the ows_taxId_SPLocationSite crawled property, that way you can easily retrieve the web URL of the item.

SharePoint 2013 - Crawled property

SharePoint 2013 - Crawled property

SharePoint 2013 - SPWebUrl managed property

SharePoint 2013 - SPWebUrl managed property

Result

SPWebUrl compared to the SPSiteUrl

SPWebUrl compared to the SPSiteUrl

Comments