SharePoint 2013 Web Part: Content Search

CropperCapture[77]**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:

Basics

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).

CropperCapture[80]

Refiners

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.

CropperCapture[81]

Settings

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.

CropperCapture[82]

Test

The test tab shows you the actual query text that is used behind the scenes to create that query.

CropperCapture[83]

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.

Display Templates

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.

CropperCapture[84]

 

Property Mappings

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.

 CropperCapture[85]

Settings

The Result Table drop-down lets you pick from Relevant Results, Personal Favorite Results, Refinement Results, and Special Term results.

 CropperCapture[87]

In summary:

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.

CropperCapture[78]

27 comments

  • Hi Laura,

    nice post on one of the great new SP 2013 features. The Content Search WebPart is just awesome.

    • Can you use this webpart to create an employee directory?

    • Great question, but that product is almost 10 years old and I haven’t worked in it a long time. Not sure.

    • I have the name pulled in from active directory..I’m just trying to sort it and pull the phone numbers and emails in..

  • Hi Laura,
    This web part looks cool. I am wondering since the content of this search web part is only fresh as the last crawl, wouldn’t it be nice to also show the last refresh (recrawl) time stamp somewhere on the web part? This way everyone looking at the web part knows whether their content is 20 mins or 2 hours old etc. Not sure if this capability is available OTB…

  • I got a question from a colleague of mine about the XSL editor option that seems to be gone from the web part toolbar. How would one go and modify the XSL template for the search results in SharePoint 2013? Any ideas? Thanks

  • Hi Laura,
    thanks for this post! Do you have an idea which settings I need to change to have Content search web part or the content query web part avaiable? I enjoyed your Video a lot, but without having these options, I can’t make use of it. Any ideas?

  • Nishan,
    There’s some new continuous crawl type of feature now in 2013, so you shouldn’t have to worry about when the last crawl was.

    Nik,
    Here’s a post from the SharePoint team blog that may answer your question: http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=1050

    Beatrix,
    Content Query web part is gone, and content search web part doesn’ seem to exist in office 365.

  • This is really a nice post, I’d like it very much, my question is can we apply formating on serch result e.g.: if I qant to add columns with some fancy buttons and manage that item using that button? Is this thing possible with it?

  • Certainly Content Search web part is a nice improvement over content Query web part because of the limitation of Site Collection. The functionality of using different styling is also been upgraded with more style using XSL. Another most valuable feature is dynamic query builder along with the query variables like Today, Current User Name etc.

  • Hi Laura-

    I am trying to use the Content Search webpart to create a suggested people listing for my job site (SP2013).

    Basically I have a custom list of Jobs and a contact list of Candidates. I want to match the skills required by the job with the skills that a candidate has. (I should mention that my Skill column is a Managed Metadata column)

    The thing is, that both jobs and candidates will have multiple skills requirements and so far I can only match 1 candidate skill to 1 job skill. I have searched everywhere because I am having trouble with the Statement and I am not very familiar with the query language. Maybe I am completely out of my range at this point but I really wanted to give it a try before going into SPD.

    If I were to tell the query story I would say “From all Candidates, show me the list item in Candidates where Skill (Column in Candidate List) contains Skill (In Job Skill Column)”- Example: If a job requires HTML, CSS and C# and my Candidate has HTML & C# knowledge listed in the Skills column (HTML; C#) I want him/her to show up in my results as a suggested candidate.

    The job list and candidate list are separate. They share a site column called Skills. I have all this in a separate webpart page called candidate search, I have tried filters, CSWP, CQWP, etc… with not much luck.

    Any ideas of how I can accomplish this with the Content Search web part would be absolutely appreciated! Your posts are always so helpful!

  • Hi Catalina,
    That sounds like a really cool idea, but I can’t think of how it could be accomplished. I did find this Keyword Query Language (KQL) syntax reference for you… http://msdn.microsoft.com/en-us/library/ee558911.aspx

  • Hi Laura
    I’ve working on setting up some sites in SharePoint Online and wanting to use the Content Search webpart. I can get it to provide results in the Search Result Preview pane of the webpart but when I save the query and the webpart no results are acutally displayed on the page (despite that I can see the same documents as are displayed in the preview results).

    Any ideas? This is driving me nuts!

    thanks

  • Angela,
    Hi, I’ve seen that happen a couple of times, but it seems pretty random. Usually I’ve been able to delete the web part and start over and the problem goes away, or I just tweak it like crazy and it eventually works, but there is no rhyme or reason. :-S

  • I am using Content Search Web Part to surface the popular item in site and in Display I am using List Control and Picture on left, 3 lines on right.
    I get the correct result set BUT the issue is I am not getting thumbnail for items.

    In regular search center I am able to get the thumbnail and hover over is working fine but struggling with this web part.

    Any suggestions?

  • Hi Laura,
    I have a content search web part which displays recent forums created. I chose List as Control Display Template and Two lines for Item Display Template. (I just need a list, with the title and author information). I’m new to Sharepoint and still working my way to explore its features.

    Bottom line is, I would like to get rid of the icon found at the left side per result. On your provided screencap, the Word document icon.

    Hoping or your quick response. Thanks!

    Twitter handle is @donna_mae

  • Anup,
    You can try using the Search Results web part instead of the Content Search web part, and you may get the look and feel that you need.

    Donna,
    Hi, unfortunately they don’t give many options for adjusting the way these look. The next step is to try (what I suggested to Anup) or you’d have to get a dev involved and create a custom display template.

  • Thanks for the post. I see Content Rollup, but I do not have the option for Content Search, just Content Query within it (a few others appear to be different/missing as well). Is the Content Search option specific to a certain version of SP 2013? We are running Standard Server. I’m wondering if we don’t have something configured properly for this to show, if it is supposed to be available within our version.
    I am trying to use the web part to aggregate all new and recently changed documents, which seems easy enough, but what I currently have setup has a quirk and is showing text from the files in place of the name of random files. The Content Search appears to be exactly what I need, I just don’t have the option.
    Thank you – Angela

  • How do I change the “SEARCH RESULT PREVIEW” on my content search, I am new to this also, what if I want it to display things from a particular part of the share point site and not use what it is displaying.
    Thanks

  • Hello Laura,

    Could you please guide on- How to Display the Sites names in a site collection based on the Permissions levels that a user has on that Particular site collection Using Content Search Web Part.
    I am facing issue in writing the exact query to get my results

    Thanks in Advance for your reply.

  • I am trying to find an online resource that gives explanations of the 100’s of managed properties in the CSWP Property mappings configuration. Basically I am trying to do a blog sites’ rollup (many blog subsites rolled up onto one page, displaying blog title and latest post) and thought this webpart would do the trick but all I have succeeded in getting is the title.

    Thanks, Alon (@alongoldberg)

  • I can see the results I want in the Test but I see no results when the Web Part is live. I’ve tried not changing any settings but still see nothing. The search is working on the site and I can happily search and see the items displayed in a normal site search.
    Any suggestions why I can’t see any results on the live web part?
    Thanks
    14Data

  • Angela,
    Yes, as stated in the first sentence, it’s enterprise only.

    Savio,
    Yes that’s “restrict results by app”, which is in my Basics section above.

    Jagan,
    Switch to Advanced Mode, and then in the keyword filter box, choose Only return sites, and click the Add keyword filter button. This will put contentclass:STS_Web in your search query box. Users will inherently only see sites that they have permissions to. If you want to see site collections, that’s contentclass:STS_Site

    Alon,
    Yes, I agree, it would be nice if that were documented. I haven’t come across any documentation on that, and usually just guess.

    Tony,
    I’ve seen it do that based on a weird color scheme or branding, and then I’ve seen the stuff appear once I exit edit mode on the page. Not sure how to fix it, though.

  • Done ! nice blog….Thanks

  • Is there any way to change the speed of the rotation (change at a slower rate) on the CSWP? I don’t see an option anywhere in the settings.
    Thnx

  • Hi,
    Is there a way to display Content Search web part results in a list view with additional columns added to it? if Yes, how?

    Thanks

  • Hi i hv problem using Web Part Popular Items. Public user cannot view the popular item. May i know why?

Leave a Reply