Although the out-of-the-box search Web parts provided by Microsoft Office SharePoint Server (MOSS) 2007 are very customizable, there are situations where you may want to develop your search interface to hook into MOSS. This download consists of a Search Box user control and a Search Results user control. The Search Results user control uses the new
FullTextSqlQuery API to return the search results. As user controls (I might add a Web part version later), the look and feel are very easy to customize.
The Search Box user control SearchBox.ascx has several
SearchResultsUrl - URL of the search results page. Default is the current page.
DefaultSearchScope - Default search scope. Default is
SearchScopes - A comma delimited list of search scopes. If provided, they will be rendered in a dropdown list for user to limit the scope of the search.
The Search Results user control SearchResults.ascx has several
ResultFields - A comma delimited list of result fields. Default is
WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL.
RowLimit - The number of search result items returned per page. Default is
HitHighlightedTag - The HTML tag (without the enclosing angled brackets) to highlight the search words when rendering the result field
HitHighlightedSummary. Default is
b for bold.
The sample Visual Studio 2005 SP1 solution includes all the support files you need to build and deploy the user controls, minus strong name key files (*.snk). (The supplied Visual Studio 2005 solution contains Web Application projects supported only by SP1 or after.) It contains two projects:
Office.Server.Search project contains source codes for the user controls. The
Deployment project contains a pre-build script to aggregate all the files needed for deployment. It contains a Solution directory where a WSP file is generated and deployed by a post-build script.
This structure of Visual Studio solution and projects is designed to be scalable to full blown MOSS/WSS development and deployment. You could add additional projects like
SharePoint for WSS/MOSS development or
SharePoint.Publishing for MOSS Publishing development. Within your projects, you could have other custom components like Web controls, Web parts, custom fields, feature receivers etc.
Of course you can install the user controls as is without further customization. Using
stsadm, install the solution file QuestechSolution.wsp in \Deployments\Solution\:
stsadm -o addsolution -filename QuestechSolution.wsp
Then go to SharePoint Central Administration/Operations/Global Configuration-Solution Management and deploy the solution to selected Web applications. To insert the user controls to a page, modify the appropriate master page or page layout as follows:
<%@ Register TagPrefix="Questech" TagName="SearchBox"
- Enterprise Search Query Object Model Overview
- Custom Enterprise Search Web Part Code
- Creating a Web part to explicitly search custom columns in MOSS 2007 - Part 1 and 2
- MOSS - Search Scopes
- V1.2 - 2008.08.26 - Added support for sites run under extended web applications
- V1.1 - 2008.04.22
- Included sample Visual Studio 2005 solution for compiling and deploying the user controls
- Updated installation instructions
- V1.0 - 2007.03.22 - Base