SharePoint 2013 Web Part: Content Search
**NEW VIDEO to go with this post:
The new content search web part in the SharePoint 2013 preview (enterprise) is just awesome, awesome, awesome.
Remember quite a while back when I wrote a post about how to utilize the search results web part to show the logged in user a list of sites that they have access to? Well now in this new SharePoint, this web part is used all over the place, and you can also insert it anywhere you want. For example, when you are on your My Site and you see a list of all of the tasks assigned to you, THAT is this web part rolling up that content from all over the farm. Also, on the Community Portal (site collection template), you see a list of all community sites rolled up in one list. THAT is also this web part. There are many other examples, but let me go ahead and show you the coolness:
When I click the Change Query button, it brings up this interface with TONS of options, and as you change options your live results show in the search results preview on the right:
You can select from Documents, content types, tags, videos and more, and then pick the scope, such as a certain site or site collection, or unrestricted (whole farm).
There a many refiners (filters) you can choose from. In this case, SharePoint recognizes that I created a column called “Department” in a document library, so it shows as a refiner. There are dates, file types, creator, editor, content types, size, and more.
On the settings tab, you can even change the performance of your web part on the page! Wow, this is much better than that old content query web part which could be a real hog.
The test tab shows you the actual query text that is used behind the scenes to create that query.
After I click OK at the bottom of this query page, there are still more settings available in the web part properties.
Number of Items to show
You can set up the default number of items to show in the web part. The default is 3.
The control drop-down box lets you choose from list, list with paging, and slideshow.
The Item drop-down box has selections such as “picture on left”, 2 lines, large picture.
Depending on what you select in the Item drop-down box, you have different choices in the Property mappings.
Since I chose two lines, I get to customize what those 2 lines are if I want to. Right now, line 2 is empty, but I can pick another property to display on that second line, like the last modified by person, or a description or something.
The Result Table drop-down lets you pick from Relevant Results, Personal Favorite Results, Refinement Results, and Special Term results.
Remember that for search results to be accurate, you have to actually have your search crawls / indexing set up and on a schedule. If your search only indexes the content once a day, then the results in this web part could be a day old. If you set up your index say, every 20 minutes, you’re going to have much more accurate and current results displayed.