A very interesting feature that has been introduced in SharePoint 2013 is – “Content Search web-part (CSWP)” which purely depends on search index and search crawling mechanism. In other words, once you add data in list or library , it will not be reflected instantly, instead it might take 15-60 minutes to reflect the data, based on search crawling.
Content Search web part is available as out-of-the-box (OOTB) web-part in “Content Roll-up” category which you can use to show data from various sites or sub-sites, on your application landing page. It gives us the option to search data from Current Site or Site Collection. Also, we can specify a URL to get the data from.
In my case, I was working on a SharePoint Online project (Office 365), where I want to roll-up & roll-down data from 300 sub-sites. I decided to use CSWP, because using jQuery or Client side object model, it would be tedious to get the data from such sub-sites. (Remember in server side object model, we used to have SPSiteDataQuery API)
While working and playing around with CSWP, we created Search Managed properties based on crawled properties for specific list/library columns and our CSWP queries were all based on Content Types. Initially, my understanding was that the moment I created managed properties, I can use them in CSWP queries. But that was not happening. 😦 and data was not appearing as CSWP Search results. I also contacted Microsoft for this issue, and they said that it may take time to crawl the data depending on the last search crawl.
Then I found two important aspects of CSWP and Managed properties. –
- In site settings, there is a option – “Search and Offline availability” where you can “Reindex site”. This option helps in re-indexing of the site and will take your site little up the next time SharePoint will start crawling the data.
- Since the managed property was not showing in CSWP queries, and was not showing the results – I added some data in list and you know what – Managed property shown up !!! Hurray :). This suggests that if you add data in list/library and search for managed property, it will show up.