MOSS gives site admins the tools to target searches to users' needs
|
Executive Summary: Microsoft Office SharePoint Server (MOSS) 2007 includes the Advanced Search Web part and the Search Center site template so SharePoint site administrators can take control of the search environment. You can set targeted search scopes, and provide custom search forms and results pages. |
Search capabilities in Microsoft Office SharePoint Server (MOSS) 2007 include a host of powerful features suitable for a large enterprise intranet or extranet. Although Windows SharePoint Services (WSS) 3.0 also includes many of these features, only MOSS provides the easy customization of the search scope and UI. SharePoint administrators can customize MOSS to meet many specific business needs.
With MOSS, you can search a wide array of sources in the network, such as Web sites, file shares, and Microsoft Exchange Server public folders—not to mention site contents within the SharePoint server itself. The MOSS standard site collection feature pack offers two search enhancements, an Advanced Search Web part and the Search Center site template, that Share- Point administrators can use to fully customize the site’s UI and search behavior. SharePoint offers two display options for search results: through a search Web service or through the built-in search results page. The search Web service, which lets you access results from client applications outside of the context of SharePoint, is development-intensive and beyond the scope of this article. Managing search scopes and accessing search results from within the SharePoint UI, however, doesn’t require a developer’s skill set—although it isn’t necessarily intuitive or straightforward.
Customize Search Scope
Because SharePoint can crawl contents from a wide array of sources, you use search scopes to
let users search a specific subset of the workspace’s entire contents. Targeted scopes help you
get better search results while boosting overall search performance.
You customize search scopes in MOSS in the Shared Services Administration section of SharePoint Central Administration. Shared Services are applications that run behind the scenes on their own Microsoft IIS Web applications. These services can be configured from a single place and shared for use by SharePoint sites on multiple MOSS and WSS servers— hence the name. The MOSS search engine is an example of Shared Services. Keep in mind that someone with administrative privileges in the regular SharePoint content sites won’t necessarily have access to Shared Services Administration.
By default, MOSS has two out-of-the-box search scopes:
These scopes both cover a rather broad range of sites. You’ll have to create your own scopes to target more specific areas of your content. Take, for example, a document library list named Catalog, with various custom columns that track document metadata. In the default setup scenario, if you want to search for content only within this document library, you would have to navigate to that document library, then select This List: Catalog in the search scope drop-down menu.
The first item in the drop-down menu is specific to each page. If you’re somewhere else on the site, you’ll see different options on the list—but you won’t see the This List: Catalog scope. The solution is to add a new search scope that appears in the search scope list on every page. Here are the steps to follow to create the new scope:
Now that you’ve created a new search scope, you need to specify the content this scope should query when searching by adding a rule for the search scope, as follows:
You’ve now specified a content source for the custom search scope. The next step is to have SharePoint display this custom search scope in the search drop-down menu. This configuration is done through the SharePoint site’s Site Settings page:
Schedule the Search
Crawl
The SharePoint search engine crawls the
content in the search scope every so often.
The frequency of this crawl is controlled by
a search schedule. By default, SharePoint is
set to crawl only once in a 24-hour period
for the default search scope content. After
you’ve defined your custom
search scope, you
need to set up a crawl
schedule for it. You can
set up separate schedules
for full crawls, which
build an index of all site
content, and incremental
crawls, which index only
changes to content since
the last crawl.
A full crawl takes longer and is more resource intensive on the server than a partial crawl. Therefore, it’s best to schedule fewer full crawls than incremental crawls and to schedule them during non-peak hours. A partial crawl, however, doesn’t detect all types of changes.
For example, when a row item on a Share- Point list is changed or deleted, a partial crawl won’t find the change because it can’t recognize changes to .aspx pages. A full crawl is required to re-index the list data after such changes.
You set up custom crawl schedules through the site’s Shared Services Administration. Follows these steps:
Customize the
Search UI
Adding a custom search scope to the search
drop-down menu is an example of search UI
customization. MOSS provides numerous
out-of-the-box features, such as Web parts
and site templates, that let you customize the
UI of both search and results pages. Search
Center is a new site template dedicated
to search functionality; it’s embedded with
many standard search-related Web parts.
The Search Center site template comes
in two flavors: Search Center Lite and Search
Center with Tabs. Search Center Lite is available
in site collections by default where
the Office SharePoint Server Publishing
feature isn’t activated. Search Center with
Tabs is available in site collections with the
publishing feature activated; this version lets you create a custom UI that includes
tabs with different searches. You can see a
list of both activated and available features
of a site by going to the site collection’s
administration page and clicking Site collection
features. The Search Center is usually
a sub-site under the site collection with the
URL http://
Continued on page 2
Customize Search Tabs
You use tabs to group search queries and
results by scope. By keeping each scope in its
own tab, you can also create a different search
form for each scope. Users access a custom
search form to query by fields or values that
apply only to a particular scope, and the
results displayed pertain only to that scope.
By default, the Search Center contains two tabs, All Sites and People. These tabs appear on the Search Center home page. The All Sites tab searches all SharePoint content sites; the scope for People is limited to My Sites. If you want to add a new custom tab, follow these steps:
You’ve added a new search tab named Catalog to your Search Center, and it includes the Advanced Search Web part.
Customize Advanced
Search
Earlier, we created a custom scope that you
could access from anywhere in the site to
search for contents only within the Catalog
document library. Now, imagine this library has a custom column
named Color Category.
We want users to be able
to search for documents
in this library that are
tagged with a particular
color. With the standard
search box, if the user
searches for a color (e.g.,
green), the results include
all documents that have
the word green anywhere
in the document body or
metadata. But what if the
user wanted to search
only those documents
that are tagged as green
in the Color Category
field? The Advanced Search Web part, with
some customizations, can help answer that
question. Here’s how:
PropertyRef Name=”ColorCategory” />
Manage Metadata
Property Mappings
Note that in step 5 above, we referred to a
property definition with the name ColorCategory.
SharePoint doesn’t yet know how to
search for this property. You need to define
this property such that it maps to the field
named Color Category in the Catalog document
library. This definition is done through
metadata property mapping.
SharePoint list and document library
fields are also referred to as properties. As the SharePoint search engine crawls through
lists, it indexes the properties, which are
then referred to as crawled properties. You
define relationships between list properties
and crawled properties through Search Setting’s
Metadata Property Mappings. For the
example above, you can define a new managed
property named ColorCategory and
map it to the crawled property that points
to the document library’s field named Color
Category by following these steps:
Continued on page 3
Customize Search
Results
By default, the Search Center displays results
in the results.aspx page. You can customize
this page or create your own results page.
For example, consider the document library with the custom Color Category field. When
a user searches against the Catalog scope,
you want the search results page to display a
field named Color Category. You can achieve
this by modifying the XSL markup of the
Search Core Results Web part in the search
results page.
Start by performing a search with the Catalog scope so that you get a results page where only items that fall within the Catalog scope are displayed. After you have such a page, follow these steps to create a new search results page:
Column Name=”ColorCategory”/>
Remember that we’ve already defined the
ColorCategory column. The SharePoint
search engine returns data internally in XML
format. This XML data is transformed to an
HTML view through XSL markup.
xsl:template match=”Result”>
in the result template node:
Now when you perform a search using the search box, you’ll see the Color Category property exposed in the search results area. By following these steps, you can expose any property that’s already stored in the metadata
Control SharePoint
Searches
You should now have a good idea of how
you can customize the search experience in
MOSS 2007. The procedures shown in this
article, though simple, can easily be leveraged
to create more meaningful business solutions
that can crawl and index a large amount of
disparate data, yet offer end users targeted
search capabilities to zero in on a specific subset
of data. Custom search scope definitions
also let administrators schedule indexing and
crawling of each scope separately: Only scopes
with frequently changing contents need to be
crawled frequently. This ability not only saves
server resources, but it also makes the search
results more accurate and fresh.