Inconvenient Images By Search in SharePoint 2013


Content By Search is the new publishing model in SharePoint 2013. And although crawling and retrieving content is straight-forward, what about images?

Content By Search in SharePoint 2013

Content By Search, also known as Cross-Site Publishing (XSP), is the new publishing model introduced with SharePoint 2013. In previous versions of SharePoint the physical location of the content determined how it would be published. Although it is still possible in SharePoint 2013 to use the traditional publishing model, the newest version of SharePoint allows us to leverage SharePoint Search for publishing content.

Publishing content using SharePoint Search is much more powerful than using the traditional approach. First of all it breaks the Site Collection boundary that apply to the traditional content publishing approach. When using SharePoint Search for publishing content we can easily publish the content across Site Collections but also across Web Applications or even Farms! By decoupling the authoring and publishing environments, search-driven publishing promotes content reuse but probably the biggest advantage is the ability to build truly dynamic and intelligent websites. SharePoint Search offers us a number of capabilities such as recommendations and user segments that we can leverage to deliver personalized experiences and content to our users.

The new search-driven publishing model supersedes the traditional publishing approach introduced in SharePoint 2007. Even though you might not be publishing your content across Site Collections, it is still worth it to benefit of the new search-based publishing and the power it offers.

When building public-facing websites you often aggregate not more than content alone. Often you build dynamic accordions and carousels and use images to enrich the user experience of your website. With the new search-driven publishing capabilities we could improve the experience by adding content recommendations and user segments into the equation presenting users with even more relevant content.

To leverage the new search-driven publishing model we first need to have our images crawled by SharePoint Search and once they are available in the search index, use the Content Search Web Part to build dynamic and personalized carousels.

If you however try to retrieve your images using search you won’t really get what you expected. Following is the result of a REST search query for an image.

01

If you take a closer look at the Path property that you would expect to contain the full URL of the image, you will see that it points to the image’s List Form instead.

Images By Search – better together

It turns out that the URL of the image is already there but it’s stored in a different property. If you want to retrieve the URL of an image instead of getting the value of the Path property you have to get the value of the PictureUrl Managed Property that contains the full URL of your image.

Result of a REST search query for an image. The PictureUrl property points to the image’s URL

Summary

Search-driven publishing is the new content publishing model that SharePoint 2013 introduces to help us build dynamic websites. When trying to retrieve images using search, by default the Path property will return the URL of the image’s List Form instead of its URL. The URL of the image is stored in the PictureUrl Managed Property that you can use instead when building search-based solutions.

Others found also helpful: