In part 1, we set up an enterprise search center and adjusted the search scopes that are used in the dropdown.
In part 2, we will setup our own search scope.
Setting up your own search scope
Search scopes provide a powerful way to help your users search for the kind of content they are wanting to find. In part 1, we used a scope called “documents only” that is defined at the farm level and will only find what SharePoint considers documents.
There are many other things you can do with search scopes such as:
- Limiting the results to certain kinds of document formats (Word, Excel, etc) based on the file extension.
- Limiting the results to specific sites or sub-sites. Note that you don’t need to create a “this site” search scope since the context sensitive search box on the site will do that already.
- Limiting the results to items with a specific value in a column.
Example 1: Setting up a search scope for all ICT site collections
ICT has a couple of different site collections that it uses, 1 main one for the ICT intranet, a site collection specific for the ICT Planning and Priorities Committee. If we want to provide a single search scope that will allow for searching across these site collections, and only these site collections, we can do that as follows:
- Under the Site Collection Administration of the Site Settings, go into Search Scopes.
- Select New Scope, on the resulting page, give it a meaningful name (like “All ICT Sites”) and description.
- Click off all the display groups would like the search scope to appear in and click OK.
- It will now take you back to the search scopes listing, select Add Rules beside your newly created scope.
- You will now have a choice of the type of rule; Web Address, Property Query, or All Content. For this example, we are going to use Web Address (which is selected by default).
- You can select different kinds of web address and supply a value for the selected one. We are going to use Folder in this example (which is selected by default).
- In the appropriate box, enter the URL of the main ICT site collection: https://itshares.usask.ca/
- The options for each rule allow you to include, require, and exclude the content matched by this rule. In this example, we are going to use the default Include.
- Click OK to save this rule. You will see a count beside the rule that is the approximate number of items that this rule will select. Please note that this number is security trimmed based on what you are allowed to see, so the actual number may be higher.
- Select New Rule and repeat steps 5 – 9 for each additional site collection you want included.
Example 2: Property search
Say we want a search that showed only documents that one of the ICT directors had authored (I am not sure why we might want to do this, but it serves an example). In this case we are going to use the Property Query type rules.
- Create a new scope like you did above.
- Create a new rule and select Property Query as the type. Note that the dropdown of properties can be quite long, and contains things like; Author, content class, IsDocument, File Extension, and things that start with “owstaxId”. This kind of rule provides a lot of flexibility, but also can take some fiddling around with to get to work correctly.
- For our example, we want to select Author, and type in the persons’ name (our Active Directory has names in Last, First format).
- Do steps 2 and 3 for each of the people you want included in the scope.
- To make a rule that makes this search scope only include documents, make a Property Query rule, select IsDocument from the dropdown, and enter the value 1. Lastly, make sure this rule is indicated to Required for the match type. This will ensure that only items that are documents are included, regardless of what the other rules might include.
More about search scopes
Searching based on content class will allow you to control the type of list or library that results are included from. Chris Zhong has provided a list of content classes in her blog.
You want to limit the number of search scopes that a user is presented with. Remember that most of what you can do with search scopes the user can also do themselves on the advanced search tab (especially if you customize it a bit), so you don’t need to come up with a scope for every occasion.
The search scopes you create at the site collection level are only available to search centers inside that site collection. Search scopes can also be defined at the farm level for use in any search center, an example of using one search scope is covered in part one of this series.
Search scopes provide you with flexibility in providing a good search experience for your users.
In part 3, we will look at some of the web parts that are used on search pages and different ways to customize them.
Thanks for reading.