Question

We have a catalog set up for cross-site publishing and have connected it up with our user site. We've set up the managed catalog to rewrite the urls to the local site.

We use content search webparts to display the items on our catalog pages. If I use the debugger to pause the item template when it is rendering I can inspect ctx.CurrentItem and see that there is an OriginalPath property which points to the authoring side and there is a Path property which is rewritten to the local site. This is as it should be.

The problem

When I search for the same item, I see the OriginalPath, but the Path property is empty in the search results. This means that the link in the search results goes nowhere.

I found this thread which talks about adding ServerRedirectedURL to a custom item template. I'm just using the OOTB templates -- default, item, commonbody, etc. I did notice that several of the do not have the ServerRedirectedURL property in the mapping, so I added it to them. That didn't work, and I see the ServerRedirectedURL property is always null.

I also tried using the REST search api. When I query for the same items the Path is also empty.

What is it that CSWP knows that Search Results webpart and REST api don't?

How can I get the rewritten, local, friendly Path for my search results items?

Was it helpful?

Solution

If you added that managed property to default display templates you need to create new manage result type from that display template.

Go to YOURSITE/_layouts/15/manageresulttypes.aspx?level=sitecol and click copy on that display template, add only different name (like WebPageNEW) and save.

Go again to YOURSITE/_layouts/15/manageresulttypes.aspx?level=sitecol and you'll see alert that you need to refresh to update new maanaged properties. Click update result types and you will see that new property.

https://blogs.technet.microsoft.com/tothesharepoint/2013/09/06/how-to-display-values-from-custom-managed-properties-in-search-results-option-1/

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top