Adding the Content by Search Web Part
Before we being, you must first add a CSWP to your SharePoint page.
3. From the Content Rollup category, select ‘Content Search’ and then click Add.
Configuring the Query
Now that you have added the CSWP to the page, we can configure the query to return the desired results. The CSWP can aggregate content from any list or library from within the SharePoint farm and then filtered based upon the type of content or by meta data. Once the query has been built, you will be able to configure the display options.
To configure the query:
3. The Basics tab displays some configuration options on the left hand side pane and preview results in the right hand pane. This is useful allowing you to see what content your web part will display prior to completing the configuration.
4. The first field in the Basics tab is the ‘Select a query’ field. The queries that you can select from are ‘Result Sources’ which are configured within the Search Service application through SharePoint Central Administration or via the Site Settings.
5. The example I will give is a configuration to rollup Tasks from Task lists. One thing we know about Tasks is that they are created using the Task content type of a content type that derives from Tasks. Therefore, I will select ‘Items matching a content type’ as my result source.
7. Although, the field is not in the correct order, the next field to set would be the ‘Restrict by content type’. Note that this field will change depending on your Result Source. Set the option to Task to rollup tasks. The preview pane should show the tasks that you will be aggregating.
8. You can then further restrict the results using the Restrict by tag or Add addition filter options.
9. You can further refine the results using the Refiners tab. An example would be filtering by Author or Assigned To.
10. The Settings tab allows you to set certain settings that affect the load behaviour of the web part among others.
11. The first setting it whether to use Query Rules. The Query Rules are set within the Site Settings and can be used to fine tune the search results.
12. Finally the Test tab provides you with the query text which can be used to test the search results.
Configuring the Display of your results
Now that the scope and the query is set, we need to make the results look better. The CSWP toolpane contains Display Templates depending on how you want to display the results. There are three types of control. List, List with Paging or Slideshow. The Item will field will then show variations of the displays using the display templates.
Once you have selected the display template, expand the Property Mappings and populate the managed property fields with the columns that you wish to display. In my example I have configured the display settings for a Task List.
The results are now shown within the Web Part.
Clicking the hyperlink for each result will navigate you to the item itself.
For more details check this video. Roll up content from across multiple sites in SharePoint 2013
No comments:
Post a Comment