Create and Configure a Scope to Only Return Documents in a Search Result
It is evident that SharePoint can index content in web sites, file shares, exchange public folders, or any other content that has a URL. However, many users like to execute a search which is restricted to a specific type of content such as Tasks, Announcements, Events, Documents, Blogs etc or a content source such as a document workspace or a team site or a file share etc. On a similar note I would like to quote what one of our customers who was evaluating our search product Longitude for SharePoint asked for.
"We are most concerned with documents and to us, most of the other items that come up that may contain the search string are clutter and it would be nice to easily filter them out"
The customer basically wanted a provision to narrow down search to documents only and was not interested in the announcements, events, and wiki pages etc that came up in the resutls.Typically when the requirement is about being able to execute a search restricted to a content type or a content source, SharePoint Search scope is the way to go.
In this article, we will go through all those configurations required to create a search scope that will be dedicated to return only documents. Before we start with the configurations required, let's take a look at the basics of SharePoint search scope.
In an enterprise, gigs and terabytes of data is crawled from various content sources on a regular basis. The crawls create a single content index representing all the content sources. SharePoint provides search scopes as a way to filter the content index to define a subset of it. By effectively defining a section of the content index a head of the query time, search scopes facilitate to limit the results that are returned from the index. Search scopes are pre-compiled and efficient.
SharePoint has two types of search scopes.
The Contextual scopes are created automatically based on the context of the site area user is currently working on such as a web or a list etc. In a SharePoint site, these scopes read like "this site", "this list" etc.
The Custom Scopes are the ones that an administrator can create to target a specific type of content. Two types of custom scopes can be created:
- SSP Level Scopes are global and shared across all the site collections that are associated with the SSP. The SSP level scopes are managed at the SSP level by a farm administrator.
- Site collection level scopes are local to a site collection and are managed by the site collection administrator.
In the steps outlined below, we will be creating a SSP level scope called "All Documents" and add a rule to include only documents.
Step1: Create a all documents scope
- Browse to the central administration site and Click on the SSP.
- Click on search settings and then Click on view Scopes.
- Click on new scope link.
- Enter title as "All Documents" and leave other details blank and Click OK.
IsDocument is a managed property provided by SharePoint and is true for all documents only. Therefore, before adding a scope rule to the scope "All Documents", we must ensure that this property can be used in scope. Follow the steps to allow the property to be used in scopes.
- Browse to the central administration site.
- Click on the Shared Service Provider (SSP).
- Click on Search settings
- Click on metadata property mappings.
- Find the managed property IsDocument and set "Use in Scope" property to true and Click Ok.
- Browse to the central administration site.
- Click on the Shared Service Provider (SSP) for the site.
- Click on Search settings
- Click on View Scopes.
- Click on Edit Properties and rules for the scope "All Documents".
- Click on New Rule.
- Add a property query rule where the property IsDocument=1 and set the scope behavior to require and click OK.
A scope display group is used to organize a list of scopes. The scope display group is then assigned to a search box to be able to search on those scopes. To add the scope "All Documents" to a scope display group, follow the steps below:
- Browse to the site collection for your search center (This is the site collection which has your search page).
- Select Site actions>Site settings>Search scopes. You will notice that the scope "All Documents" has no scope display group assigned at this time. We can either create a new display group and add or add it to an existing group.
- Click on the scope display group "Search Dropdown" and Select the scope "All Documents".
The scope display group "Search Dropdown" has our scope included in it. In this step, we will ensure that our search box webpart uses this scope display group.
- Browse to the search page and select site actions>edit page.
- Select edit>modify shared webpart on the search box web part.
- On the properties pane, expand the section miscellaneous and check the property value for the property scope display group and make sure that it is "Search Dropdown" as selected at #Step4.
Unless the scope is updated, it will not appear on the scopes dropdown of the search box webpart. To update the scope, follow the steps below.
- Browse to the central administration site and Click the SSP for the site collection.
- Click on search settings and then Click on Start update now.
Finally, some frequently asked business requirements questions from our customers where search scopes have been used.
1) I have a content source (cs1) which is an archive of past projects and is static and I have another content source (cs2) which has all active projects with dynamic content. I crawl cs1 once a week and crawl cs2 once a day. However, I want to be able to search results from both content sources at one place in a Global Search Center.
- Create a scope say "Global Scope".
- Add an include rule by selecting cs1 as the content source.
- Add another include rule by selecting cs2 as the content source.
- Use the scope "Global Scope" in your Global Search Center to be able to view results from both the site collections at one place.
Create a scope say "PDF Documents"- Add a property query based rule where FileExtension is equal to pdf.
- Set the scope rule behavior to include.
- Update the scopes.
- Search using the scope "PDF Documents".
This requirement has got two aspects of it:
Results must be documents not a blog posts or wiki pages or a list item etc- Results must have only those documents which have been tagged as Legal documents.
Create a scope say "Legal Documents"- Add a property query based rule where IsDocument is equal to 1 and Set the scope rule behavior to include.
- Add another property query based rule where Tag is equal to "Legal" and Set the scope rule behavior to require.
- Update the scopes.
- Search using the scope "Legal Documents".
As opposed to the requirement #3, this one has got three aspects of it:
Results must be documents not a blog posts or wiki pages or a list item etc- Results must have only those documents which have been tagged as Legal documents.
- Results must not have those documents which are authored by Martin.
Create a scope say "Legal Documents"- Add a property query based rule where IsDocument is equal to 1 and Set the scope rule behavior to include.
- Add another property query based rule where Tag is equal to "Legal" and Set the scope rule behavior to require.
- Add another property query based rule where Author is equal to "Martin" and Set the scope rule behavior to exclude.
- Update the scopes.
- Search using the scope "Legal Documents".
This requirement is to include content specific i.e. blog related items in the search scope that can be search against. We must see if there is a property which represents a specific type of content. Fortunately, contentclass is one such property that distinguishes content from one another. Therefore follow the steps below to create a scope.
- Create a scope say "Blogs"
- Add a property query based rule where contentClass is equal to "sts_listitem_posts" and Set the scope rule behavior to include.
- Add another property query based rule where contentClass is equal to "sts_listitem_comments" and Set the scope rule behavior to include.
- Update the scopes.
- Search using the scope "Blogs".
STS_Document | STS_List_Comments |
STS_List_300 | STS_List_Contacts |
STS_List_850 | STS_List_DiscussionBoard |
STS_List_Announcements | STS_List_DocumentLibrary |
STS_List_Categories | STS_List_Events |
STS_List_GenericList | STS_list_Links |
STS_List_PictureLibrary | STS_List_Posts |
STS_List_Tasks | STS_ListItem_300 |
STS_ListItem_850 | STS_ListItem_Announcements |
STS_ListItem_Categories | STS_ListItem_Comments |
STS_ListItem_Contacts | STS_ListItem_DiscussionBoard |
STS_ListItem_DocumentLibrary | STS_ListItem_Events |
STS_ListItem_GenericList | STS_ListItem_Links |
STS_ListItem_Posts | STS_Site |
STS_Web |
No comments:
Post a Comment