Alert This post is over a year old, some of this information may be out of date.

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

post

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.

Show image 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.

Show image SharePoint 2013 - Crawled property
SharePoint 2013 - Crawled property
Show image SharePoint 2013 - SPWebUrl managed property
SharePoint 2013 - SPWebUrl managed property

Result

Show image SPWebUrl compared to the SPSiteUrl
SPWebUrl compared to the SPSiteUrl

Comments

Back to top