Excluding Various SharePoint Items from Search Results on Internet-Facing MOSS Sites
When using Microsoft Office SharePoint Server (MOSS) 2007 on an Internet-facing site, you almost certainly don't want to include items like announcements, contacts, etc. in search results.
Consequently, I recommend customers create additional search scopes that explicitly exclude these items and use these scopes instead (for example, by explicitly setting the Scope property on the Core Results Web Part).
I actually recommend against making any changes to the out-of-the-box (OOTB) All Sites scope so that you can continue to use that scope for internal users -- as well as for troubleshooting purposes. [This is my general recommendation for almost all things SharePoint -- or other solutions for that matter -- meaning that if you can easily customize the technology to suit your needs without changing the OOTB behavior, then you should certainly use that approach. Trust me, this makes your support calls go much, much faster.]
Here are the exclude rules that my custom SharePointSearchHelper.EnsureScopeIsLimitedToDocumentsAndWebPagesOnly()
method applies to a search scope intended for Internet use:
- contentclass = STS_List_850
- contentclass = STS_List_Announcements
- contentclass = STS_List_Contacts
- contentclass = STS_List_DiscussionBoard
- contentclass = STS_List_DocumentLibrary
- contentclass = STS_List_Events
- contentclass = STS_List_GanttTasks
- contentclass = STS_List_GenericList
- contentclass = STS_List_IssueTracking
- contentclass = STS_List_Links
- contentclass = STS_List_PictureLibrary
- contentclass = STS_List_Survey
- contentclass = STS_List_Tasks
- contentclass = STS_List_WebPageLibrary
- contentclass = STS_List_XMLForm
- contentclass = STS_ListItem_Announcements
- contentclass = STS_ListItem_Contacts
- contentclass = STS_ListItem_DiscussionBoard
- contentclass = STS_ListItem_Events
- contentclass = STS_ListItem_GanttTasks
- contentclass = STS_ListItem_GenericList
- contentclass = STS_ListItem_IssueTracking
- contentclass = STS_ListItem_Links
- contentclass = STS_ListItem_Survey
- contentclass = STS_ListItem_Tasks
- contentclass = STS_ListItem_XMLForm
Note that, as described in my previous post, there's a bug in MOSS 2007 in which a search scope that contains Property Query rules only is not recognized as having any rules at all. Consequently, you will need to explicitly include the URL of your Web application using a Web Address rule.
Comments
Anonymous
March 05, 2009
PingBack from http://blogs.msdn.com/jjameson/archive/2009/03/05/bug-moss-2007-search-scope-with-property-query-rules-only-is-considered-empty.aspxAnonymous
March 20, 2009
As I mentioned in a previous post, some customers prefer to show page descriptions in search resultsAnonymous
August 18, 2009
Thanks for the info, came in handy when tweaking search results.