Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


April 2008

Customize Search Features in Microsoft Office SharePoint Server 2007

MOSS gives site admins the tools to target searches to users' needs
RSS
Subscribe to Windows IT Pro | See More Administration Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

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:

  1. On the Search Center home page, click Site Actions, Edit Page to reveal the Web parts that form this search page.
  2. Click Add New Tab.
  3. Enter a tab name (e.g., Catalog) and page (e.g., catalog.aspx), then click OK.
  4. Click Site Actions, Create Page.
  5. Create a new .aspx page with the name you used in step 3 using the (Welcome Page) Advanced Search page layout template, then click Create.
  6. In the Middle Upper Left Zone (or a different zone if you prefer), click Add a Web Part.
  7. In the Add Web Parts dialog box, select Advanced Search Box, then click Add.

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:

  1. Go to the catalog.aspx page in Search Center, then click Site Actions, Edit Page.
  2. In the Advanced Search Web part, click edit, Modify Shared Web Part.
  3. The Advanced Search Web part tool pane appears on the right. This pane lets you customize most of the search behavior and text labels. The tool pane contains the following categories:
    Search box. This category lets you show or hide text boxes for specific searches, such as “All words,” “none of these words,” and so forth. You can also change the label that appears with these text boxes.
    Scopes. Here you can specify whether you want the scope selector shown to the user. When shown, the scope selector appears as a check box list so that the user can select more than one scope for a search. You can also specify which scope grouping to show in this list. Scope groups are defined on the Site Settings page under Site Collection Administration. The default groups available are Search Dropdown and Advanced Search. The Show the result type picker option lets users specify search result item types, such as Microsoft Word, Microsoft Excel, PDF, or HTML files; this option must be checked to enable the properties search.
    Properties. This is where you can enable searches by custom fields. The Properties text box contains an XML code snippet that dictates how the properties are displayed in the search form.
    Miscellaneous. This section lets you specify the results display page. By default, results are displayed in results.aspx, but you can create your own customized results page and enter its location here.
  4. Expand the Properties category in the tool pane to update the XML snippet to include the custom Color Category field. Click the ellipsis next to the text box to view the XML code.
  5. Locate the <PropertyDefs> node and add the following code anywhere in it:
     <PropertyDef Name=”ColorCategory”
      DataType=”text” DisplayName=”Color
      Category”/>
  6. Locate the <ResultTypes> node with the DisplayName="All Results" attribute and add the following anywhere in it:
     <PropertyRef Name=”ColorCategory” />
  7. Click OK to save changes. As Figure 3 shows, when you refresh the search page, you’ll see a new value named Color Category for property restrictions.

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:

  1. Navigate to the Shared Services Administration home page and click Search settings.
  2. In the Crawl Settings section, click Metadata property mappings.
  3. Click New Managed Property in the toolbar.
  4. Enter ColorCategory for Property name.
  5. Make sure Text is selected under The type of information in this property.
  6. In the Mappings to crawled properties section, click Add Mapping.
  7. In the Crawled property selection dialog box, select the property labeled ows_Color_ x0020_Category(Text), then click OK. Note that all custom fields in lists and document libraries are prefixed with ows_ in the crawled properties index. Spaces in field names are translated to _x0020_.
  8. Click OK to save the property. You’ve now created a property definition that maps to the Color Category field. After a full crawl of the site, you can start using this property definition in the advanced search page to get targeted results.

Continued on page 3

   Previous  1  [2]  3  Next 


Reader Comments
efsaefee

blarg1234 July 02, 2008 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...

Escape From Yesterworld

Kevin points you to the funniest SQL Server website ever! ...


Related Articles Stsadm: Taking Control of SharePoint Administration

High Availability for MOSS 2007 Server Farms

SharePoint Server 2007 Unleashed

SharePoint Security Evolution

SharePoint Whitepapers Best practices for deploying Microsoft Office SharePoint Server 2007

Protecting Sharepoint with Double-Take for Windows 5.0

Dramatically Accelerate Microsoft SharePoint

Related Events Introduction to Identity Lifecycle Manager "2"

Delivering Reliable and Effective Web-Based Applications

Making Web Application Perform Better: What to Watch, How to Watch It, and How to Fix It

Check out our list of Free Email Newsletters!

SharePoint eBooks Getting Started with SharePoint

Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Related IIS and Web Administration Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing