Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  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 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:

  1. Click Site Actions, Create Page.
  2. Enter a Title (e.g., Catalog Results) and a URL Name (e.g., catalogresults.aspx) for the new page.
  3. Select the (Welcome Page) Search Results Page layout, then click Create.

    After step 3, you’ll see the catalogresults.aspx page in edit mode, which shows its various Web parts. Search Core Results is the Web part that displays the search results. You need to modify this Web part to include the Color Category column in the search results view. In the Search Core Results Web part, click edit, Modify Shared Web Part. This action displays the Web part properties tool pane. As Figure 4 shows, the tool pane contains the following categories:
    Results Display/Views—In this section, you specify search results to display per page, sentences to show in the results display, and so forth.
    Results Query Options—This section lets you specify options such as duplicate results removal, search term stemming, and noise word inclusion. Word stemming matches a search word with its grammatical variants; for example, the word crawl stems to crawls, crawled, crawler, and so forth. Noise words, also known as stop words, are words that aren’t significant indicators for content, such as the word the.
    Fixed Keyword Query—This section lets you enter a specific keyword to automatically include with every search
    Miscellaneous—Here you can narrow the scope of search results, and also choose options such as Show Action Links, Display “Alert Me” Link, Display “RSS” Link, and so forth.
    Below these categories, you’ll find the Data View Properties section, which contains the XSL markup that controls the HTML to render the search results dataset. So, to continue the process of customizing the results page:
  4. Expand the Results Query Options category.
  5. Add the following line of XML to the Columns node in the Selected Columns text box, then click OK:
     <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.
  6. Under the Data View Properties section, click XSL Editor to display the Text Entry dialog box with the XSL markup that renders the XML results into HTML.
  7. Copy the XSL markup to an external text editor, such as Microsoft Office Share- Point Designer 2007. SharePoint Designer is a WYSIWYG editor, so it helps you visualize the results of the XSL code as you edit.
  8. Locate the result template node in the markup; its first line looks like this:
     <xsl:template match=”Result”>  
  9. Add the following before the line
     Color Category: <xsl:value-of
      select=”colorcategory” />
    Note that the value colorcategory is written in all lower case, regardless of how it was written in metadata property mapping.
  10. Copy and paste the entire XSL markup back into the Text Entry dialog box, then click Save.
  11. Click OK to save changes to the XSL markup and the Web part.

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.

End of Article

   Previous  1  2  [3]  Next  


Reader Comments
efsaefee

blarg1234 July 02, 2008 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...


Related Articles Stsadm: Taking Control of SharePoint Administration

High Availability for MOSS 2007 Server Farms

SharePoint Server 2007 Unleashed

SharePoint Security Evolution

IIS and Web Administration Whitepapers Best Practices for SharePoint Backup & Recovery

Meeting Compliance Objectives in SharePoint

Improve SharePoint Performance for Remote Workers

Related Events SharePointPro 2010 Summit & Expo

Microsoft SharePoint Connections 2010

Power Up With SharePoint

Check out our list of Free Email Newsletters!

IIS and Web Administration eBooks Web Filtering: An Assessment

Getting Started with SharePoint

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

Related IIS and Web Administration Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


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 DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement