Thursday, January 15, 2015

Publish a List as Catalog and consume it in Search Results WebPart

Context: I wanted to publish a list as Catalog and later wanted to consume list’s data in a ‘Search Results’ webpart. The following diagram shows bird’s eye view of my problem;



 Solution: The figure shows that Site Collection A is publishing and B is consuming. So, first we are going to publish a list as Catalog. The following series of steps should be followed to make a list as Catalog.

  • Publish List as Catalog
  1. First create Site Columns as those will later be used as managed properties in the Search schema and will be consumed in the Results Search web part. Go to (Site Settings -> Site Columns). 
  2. Create a custom list named a ‘Cars’.
  3. Add the Site Columns into the Cars list. Add also some dummy data in the list.
  4. Now go to the (Site Settings-> Site Collection Features-> Enable ‘Cross-Site Collection Publishing).
  5. Now enable the Catalog Settings by going to (List (Cars)-> List Settings-> Catalog Settings). On the Catalog Setting page, select ‘Enable this library as catalog’ as shown below; 
  6. Now the Site Collection A with a list ‘Cars’ is ready to be consumed into the Site Collection B. Let’s now go to the Site Collection B and add ‘Search Results webpart’.

  • Setup Site Collection to Consume list catalog
  1. Before you add the webpart, first go to your Search Service and add the ‘Site Collection A’ url in the Content Sources (Search Service Application-> Content Sources) and start a full crawl by right clicking the content source.
  2. Go to the Site Collection B and activate a Site Collection feature ‘SharePoint Server Publishing Infrastructure’.
  3. Now go to (Site Settings -> Manage site features -> Activate ‘SharePoint Server Publishing’).
  4.  Once it is activated, you will find ‘Manage catalog connection’ option added into the Site Administration group.
  5. Go to ‘Manage catalog connections’, click catalog ‘connect to catalog’. SharePoint will show number of catalogs to be consumed as shown in the figure. Click connect on your publishing catalog list.
Your Site collection is now ready to consume the List catalog ‘Cars.
  • Attach list with Search Results WebPart
Follow the following series of steps to add a list catalog ‘Cars’ to Search Results webpart.

  1. Before you add the webpart, first go to your Search Service and add the ‘Site Collection A’ url in the Content Sources (Search Service Application --> Content Sources) and start a full crawl by right clicking the content source.
  2. Go to the webpart properties and click change query.
  3. Select the list and click ‘Test query’ button. You will immediately get a preview of the search results as shown below;
  4. Click Apply button to finalize the changes and Save your page to see the ‘Search Result’ webpart working.
That's it enjoy working with List catalog and Search Results webpart in SharePoint...

No comments:

Post a Comment