Tuesday, November 11, 2014

Tired of getting AllItems.aspx hits in your results?

If you append -contentclass:STS_List_* to your query template, they will all be excluded. In effect all list landing pages will be removed including:

  • AllItems.aspx
  • AllPages.aspx
  • AllPosts.aspx
  • AllCategories.aspx
  • Calendar.aspx
  • Overview.aspx

If you want to find all types excluded use the SharePoint 2013 Query Tool from Codeplex and issue the following query.

  • Row limit: 100 (or some high number)
  • Query Text: contentclass:STS_List_*
  • Collapse Spec: contentclass

The collapse specification ensures you only get one result per unique value.

3 comments:

  1. Great info. I enjoy learning new ways to use the Query Tool! Do you know if there is a way to define the collapse spec parameters using a query transform, or does this have to be done by modifying the search results webpart itself?

    ReplyDelete
    Replies
    1. You have to modify the .webpart file or definition anyways. You can possibly do it in a custom control template as well if you want to add different kinds of logic based on user action.

      Delete
  2. Excelent!!! Work very well for me!!

    ReplyDelete