Content Search Web Part in #Office365 #SharePoint online

Found something interesting while working with Content Search Web Part in SharePoint online. This web part is really powerful and least used in my opinion. To use this effectively, its best if we have a well designed Taxonomy term store that users have diligently tagged their documents with. Or not! ūüôā

In this case, I just wanted to look at all the available sites in a site collection from a page for maintenance purposes.

  • Created a custom search results page in SharePoint with a very creative name SearchResults.aspx.
  • Inserted > Web Part > Content Rollup > Content Search Web Part > Change Query

When we look at the Query text of Content Search Web Part in advanced mode¬†by default we see¬†path:”https://abc.sharepoint.com/sites/Forms/Search” ¬†(IsDocument:”True” OR contentclass:”STS_ListItem”), since I just wanted the sites under a site collection, I tweaked the Keyword Filter = Only return sites and Query Text to¬† path:”https://lcpsorg.sharepoint.com/sites/Forms” contentclass:STS_Web

In the Search Results Preview found two new  sites which I could not remember creating. NintexWorkflowForOffice365 and  FormsApp
РFormsApp redirects to Nintex forms app with options to manage the form on the site (Unpublish all forms, Export all forms and manage the base form)
– NintexWorkflowForOffice365 redirects to workflow manager for the site.

To remove these two sites from my search result, I just modified the Query Text like so:

path:”https://lcpsorg.sharepoint.com/sites/Forms” contentclass:STS_Web -SiteTitle:Nintex

This removed the list of sites from my search results that had Nintex in its title.11-15-2016 10-03-49 AM.png

Here is the resulting CSWP and Search Box in the SearchResults.aspx page:

11-15-2016 12-25-23 PM.png

Note: Default display template is used and image set to SiteLogo

Query Text of Search Results web part required to display Documents library listings can be in the following format

path:”https://abc.sharepoint.com/sites/xyz/Shared%20Documents/*” ¬†(size>0)(IsDocument:”True” OR contentclass:”STS_ListItem”) with REFINERS set to STS_ListItem_DocumentLibrary

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s