Wednesday 29 July 2015

Remove Views and allitems.aspx from SharePoint 2013 Search Results

A lot has changed when it comes to search in SharePoint. Before we predominantly used crawl rules to exclude allitems.aspx. A similar crawl rule on SharePoint 2013 may cause the pages in the pages library not to be crawled.

The best solution is to use a result source to refine the search results. 

  1.  Make a copy of the out of the box  "Local SharePoint Results" result source.
  2. Update the query text to remove unwanted results. Below will remove allitems.aspx, custom views on pages libraries and folders. You may also want to add other contenttypes to be excluded:
    • {?{searchTerms} -ContentClass=urn:content-class:SPSPeople -filename:allitems.aspx -contentclass:STS_List_850 -filename:dispform.aspx -ContentType:Folder}
  3. Edit the search results web part to use the newly created Result Source.
That should give you better search results.

No comments:

Post a Comment