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.
Here is the resulting CSWP and Search Box in the SearchResults.aspx page:
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