Exclude AllItems.aspx from Search Results in Content Search Web Part

When I was working with Content Search web part in one of my SharePoint sites, I experienced a problem where the search result for list items is displayed along with list views.
In this article, I will show you how to remove the list views in CSWP search results.
For better understanding, consider a list, EMPINFO from which you want to show the items in CSWP. To show specific list items, you might have carried out the below steps

  • Edit the CSWP and click on Change query

  • Choose Documents (System) in Select a query
  •  Choose Specify a URL and enter the list URL for Restrict by app

  • Switch to Advanced mode and remove the highlighted file extension query text.

  • You can see AllItems.aspx view along with the list items in search results.

To remove the view, you can follow any one of the below step:

  • Select “Only return items “ in keyword filter and click on “Add Keyword Filter”
  •  Just append [contentclass:STS_ListItem] after Path in Query text


Leave a Comment

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s