Enterprise Software

Query SharePoint Portal Server using search scopes

Doing a search for information using SharePoint Portal Server can produce the data equivalent of a fire hose in the face. Here's how you can use search scopes to produce only the data you need.


SharePoint Portal Server (SPS) has the ability to create full text search indexes over a wide variety of content sources. While this is one of SPS’s greatest features, it can also be a curse. Searching your SharePoint Portal Server doesn’t have to be an expedition of wading through useless results. Here’s how you can use search scopes and other SharePoint Portal Server search features to find what you need.

Seek and ye shall find
Because SPS indexes so much content, it is all too easy to create searches that return more documents than you need. Although it is possible to create an advanced search that will narrow the results down to a manageable number, advanced searching isn’t exactly easy.

Another way to keep searches under control is to define search scopes. Search scopes are defined in the content indexers that are used to create options for search locations. In the search Web Part, the drop-down list will include the This Site option that we’re all familiar with, as well as all of the search scopes that have been defined. The result is that you can search the whole site or, more specifically, a portion of the site contained within the search scope.

Out-of-the-box SPS offers you the ability to create search scopes that can create major divisions of your content. These are available from the drop-down list even in a simple search. The use of search scopes doesn’t prevent your users from searching the entire Web site. The primary limitation with search scopes is that you can define only one set of search scopes. You can’t define the search scopes based on two different organizational ideas.

Also, with out-of-the-box SPS you have the option of creating multiple workspaces; each one will index the same content, but will break down the content into different search scope structures. This is a useful technique when there are only two or three ways that the information might be arranged that are not hierarchical.

There are times, however, when even search scopes won’t solve all of your searching needs. You may have to investigate multiple workspaces, custom Web Parts, or other hybrid solutions for maximizing the effectiveness of searching on your portal. In addition to the out-of-the-box functionality, the search-programming interface allows you to manually control which content sources are indexed. Couple this with a custom interface that maps the content sources into meaningful areas, and you have the ability to create any kind of organization in your searches that you might need.

Why use search scopes?
Search scopes are a simple and effective way to control the amount of information that the search utility queries in order to resolve a search request. They allow users to easily define an area of the site that may be applicable to what they are seeking.

For instance, let’s imagine that your organization, The Mr. Big Organization, manufactures all sorts of candies. The organization has the traditional departments that you might expect: accounting, manufacturing, sales, customer service, etc. Because the Mr. Big Organization is a national company, it also has offices in upstate New York, South Carolina, Indiana, Nevada, and California.

As a midlevel marketing manager in Nevada, you’re concerned about the impact of customer service in your region.

Specifically, you’re concerned about the customer service issues with the Mr. Big And Crunchy Bar. If SPS indexed various types of content from the entire organization and you searched for just “Mr. Big And Crunchy Bar,” you might find an overwhelming number of results.

Of course, you could limit your search by including “customer service,” but you would still be seeing customer service issues from every location and department. This might be a problem if the accounting department had a profit and loss statement by product, which included a line for its allocation of customer service. Since the profit and loss would include the phrases “Mr. Big And Crunchy” and “customer service,” your search would match the profit and loss statements as well as the customer service documents that you needed.

You could continue to refine your search, perhaps by excluding accounting, but the goal of SPS’s search function is to make it easier to find the information you need. The greater the number of iterations that you have to go through to get the search results you want, the less effective the search tool is.

The answer would be to create search scopes within SPS such that all of the departments had their own search scope. If they did, then you could refine your search to Customer Service by selecting a specific search scope; it would not be necessary to further refine your scope or exclude accounting. The net effect is that you and your coworkers would be able to search more easily and with a greater success rate.

Of course, the use of search scopes doesn’t preclude searching the entire SPS search index. The This Site option still remains; search scopes just provide a simple way for users to contain their searches when it is appropriate to do so.

Effective search scopes
In the previous scenario, the search scopes were created based on a department within the organization. You should note that search scopes created by department may not be suitable for your organization. In many organizations, the way that the organization works is not so much by department but by location.

The Mr. Big Organization could just as easily have defined search scopes by location—or by department by location—or any number of ways. There are many different ways to create search scopes and, unfortunately, no right answers. The only answer is that the more specific you make the searches, the greater the potential that the scope will become too small.

In determining how you should create search scopes for your organization, you should ask yourself a few basic questions. They are:
  • Does the organization primarily measure its success based on a location-by-location basis, or on a division-by-division basis? If the organization measures success on a location-by-location basis, it’s likely that the searches may need to be limited to the user’s location. Of course, the opposite may be true, if the organization measures success on a division-by-division basis.
  • What kinds of questions does the organization ask itself? By knowing the kinds of questions that the organization asks, you can design a structure that facilitates the answers to those questions. If most people need specific product information, then a set of product-specific search scopes might be the right answer.
  • What kinds of information is it difficult for users within the organization to find? Sometimes it is valuable to evaluate the information that is difficult to find so that you can consider a structure that focuses on locating those documents.
  • What groups don’t talk to each other? If you have groups within your organization that don’t talk to each other, perhaps these can become search scopes. If they don’t talk to each other, it’s likely they won’t want to find each other’s documents.

As with any design decision, there are no hard-and-fast rules about what will and will not work for your organization. You must determine the searches that you want to make easier, as opposed to others that may not be as important or as time-consuming for the organization.

Defining search scopes in SPS
Defining a search scope within SPS is very simple. To associate a search scope with your content source, open the workspace in Web folder view, either through the Network Places shortcut or through Internet Explorer. Double-click on the management folder to open. Next, double-click on the Content Sources folder to open. Right-click a content source that has already been defined and select properties from the context menu that appears. The properties for the content source will appear as shown in Figure A.

Figure A
Content Source Properties


Next, click the Advanced tab. The display will change to something similar to Figure B.

Figure B
Advanced Content Source Properties


Enter the search scope that you want for this content source. You can key it in, or if there’s already another content source in the workspace with the same scope, you can select it from the drop-down list. Click the OK button to close the dialog.

Your search scope is now completed. After the next full re-index of the content source, which you can manually start to run immediately, the search scope will appear in the drop-down list of the search Web Part. You can change the search scopes around as much as you like to help you find the right set. The only downfall to redoing the search scopes is the time necessary for re-indexing the content.

When search scopes aren’t enough
There are times in designing a solution that there are just too many compromises. The limitation of having a single set of search scopes through which a user can search is that the single set may not be sufficient to meet the needs of the organization. There is a solution to this problem, but it’s one that has its own set of pitfalls.

Within each workspace in SPS, you can only create one set of search scopes. It cannot be a hierarchy. Additionally, attempting to provide multiple sets of search scopes causes problems when the whole site is searched. However, it is possible to create additional workspaces on the same server, each of which has a unique search scope organizational structure. The search Web Part from the other workspaces can be included in the pages from the master workspace. This will allow the user to search the same content in different ways without causing duplicate entries when the whole site is searched.

The downside to doing this, however, is that your content will be indexed multiple times. Each file will be indexed once for each additional workspace that is created. In most environments this won’t pose a major problem; however, it can lead to a real performance hit if you provide a large number of variations on how to search the same content.

Developing your own search
Perhaps the least palatable approach to providing multiple breakdowns to searching—but one that works—is to write your own search Web Part. The reason for writing your own search part is to allow you leeway in creating hierarchical search scopes and managing the number of search indexes that must be created. It allows you to control the presentation of the search information instead of controlling how the search information is indexed.

SPS search is an enhanced version of the Microsoft Index service. This is the same service that has been around since IIS 4.0 was released as an Option Pack for Windows NT 4. It is also the same indexing service that has a clearly defined interface for programmatic searches. It is this programmatic search capability that you can use to create your own search screen.

By carefully querying the internal properties that the search generates, you can manually control the results of the search by content source—something that allows you to define your own way of organizing the content by content source instead of by search scopes. By referring to the content sources individually, it is possible to organize the search screen the way you want. You can then limit the search results to the content sources that the user has selected, through the organization that you define on your search screen.

The reason that this may be the least palatable approach is that there are numerous quirks in the way the search engine works that make it difficult to build a search Web Part quickly. This is in addition to a need to develop a storage mechanism that organizes the content sources into meaningful groups that the user can search.

Searching for answers
SPS’s benefit is also its limitation. Because SPS can index so much content, it is sometimes difficult to wade through the results in order to find the right match. However, SPS is a platform that includes both out-of-box options and the ability to customize it to meet specialized needs. Once you start working with scopes and customization, you’ll be able to filter extraneous information.

 

Editor's Picks

Free Newsletters, In your Inbox