OFF311 - Programming and Customizing Search in Microsoft Office SharePoint Server (MOSS) 2007
Patrick Tisseghem Managing Partner U2U
Session Prerequisites
Power User and/or Administration Skills MOSS 2007 Search Features .NET Development XML and XSLT Basic Skills
Session Objectives and Agenda
MOSS 2007 Search and Indexing Architecture Search Administration Object Model Customizing the Search Center Programmatically Executing and Processing Search Queries Building and Deploying Custom Security Trimmers
Index and Search Architecture
Search Object Model + Web Services + Custom Security Trimmers SSP
Index File
Search Engine
Search Center Small Search Box
Protocol Handlers & IFilters
Web Sites
SharePoint Sites
Network Shares User Profiles Business Data Lotus Notes
Search DB
Property Store
Index Engine
...
Search Administration Object Model
Search Administration Tasks
Creating content sources Defining crawl rules Managing crawl schedules Creating search scopes Managing display groups to make search scopes available in the scope pickers Creating managed properties and making these available in the advanced search pages Managing best bets and keywords
Search Administration OM
Content
Schema Scopes ServerContext SearchContext
Keyword
Ranking Propagation LogViewer
Microsoft.Office.Server.Search.dll
Microsoft.Office.Server.dll
Server and Search Context
Use ServerContext class to connect to the context of the Shared Services Provider
ServerContext srvctx = ServerContext.GetContext(SSPName);
Use SearchContext class to connect to the context of the Search Service
SearchContext searchctx = SearchContext.GetContext(srvctx);
And then the Fun Starts... Build Apps for Admins...
Create content source to crawl business data Start the crawl Display the log entries Create shared search scope Make the scope available in display group in site collection Create managed properties Make managed properties available in advanced search page
Demo
Programming with the Search Administration Object Model
MOSS Search Center
Replace the search box with better user experience Search Center with Tabs
Requires Office SharePoint Server Publishing Infrastructure Customizable by administrators and developers
Search Center Lite
Does not require the publishing infrastructure Use it to provide rich search experience in collection of WSS sites Also customizable but not as much as the one with tabs
Search Center Page Layouts
OOB page layouts
Searchmain.aspx Searchresults.aspx Peoplesearchresults.aspx Advancedsearchlayout.aspx
Create and provision custom page layouts Add custom page layouts to list of available page layouts for the Search Center
Demo
Custom Search Center Page Layouts
Search Web Parts
Microsoft.Office.Server.Search.WebControls in Microsoft.Office.Server.Search.dll Web Parts are sealed => you cannot inherit from them Expose many properties
Toolpane Programmatic Access
Connected with each other not with SharePoint Web Part connection infrastructure but with Query ID property
Web Parts on Search Pages
SearchBoxEx
Scope picker Additional query terms to append Url for search results page Url for advanced search page
PeopleSearchBoxEx (Microsoft.SharePoint.Portal.dll)
Scope picker Properties to include in search Additional query terms to append Url for people search results page
Web Parts on Results Pages
CoreResultsWebPart
Paging settings Duplicate results, search stemming and noise words queries Fixed queries and Scope Selected Columns and Action links XSLT
PeopleCoreResultsWebPart
Inherits from CoreResultsWebPart
CoreResultsWebPart class is also used for Search Action Links (with different XSLT and property settings)
Web Parts on Results Pages (continued)
SearchStatsWebPart
Number of pages, total results and execution time Query ID connects it to the core results Web Part
SearchPagingWebPart
Labels, settings and possibly images for paging Query ID connects it to the core results Web Part
SearchSummaryWebPart
Summary info mode Query ID connects it to the core results Web Part
HighConfidenceWebPart
Display keywords and best bets Query ID connects it to the core results Web Part
Web Parts on Advanced Search Page
AdvancedSearchBox
Different search boxes Language picker Scope picker ResultType picker Property picker
Demo
Customizing and Programming with the Search Web Parts
XSLT
Rendering of search results is driven by XSLT XSL and XSLLink property Base class is DataFormWebPart
Demo
Custom XSLT for the Search Core Results Web Part
Custom Tabs
Tabs are stored as items in lists
List for search pages List for search results pages
Connect tab to default or custom search page
Demo
Custom Tabs for the Search Center
Search Query Object Model
Client Application
Query Keyword syntax SQL Syntax Results UI Browser or Client
Query Object Model & Web Service
Relevance Query Engine ResultTableIDataReader Definitions Best Bets High Confidence
Query Engine
Query Syntax
Keyword syntax
New for building keyword queries Use it for simple queries
SQL syntax
Supports full-text searching Extension of the SQL query syntax Use it for complex queries
The Query Object Model
Query FullTextSqlQuery KeywordQuery
Microsoft.Office.Server.Search.dll Microsoft.Office.Server.Search.Query namespace
Demo
Custom Search Box Web Part
The Search Web Service
Search.asmx
Support for both syntaxes Query Web Method QueryEx Web Method Additional methods to retrieve scopes and managed properties
Search Web Service = Research Web Service IE7 Search Provider
Demo
Remote searching
Custom Trimmers
Do something (typically trimming) before the results are shown to the user
Security trimming of search results Trim based on business/context information
ISecurityTrimmer Interface
Registration via stsadm and the RegisterSecurityTrimmer option
Demo
Building and Deploying Custom Security Trimmer
Resources
MS Press Books
Inside MOSS 2007 (Patrick Tisseghem) Inside Indexing and Search Engine: MOSS 2007 (Patrick Tisseghem and Lars Fastrup)
learn support connect subscribe
MSDN Library
MSDN Enterprise Search Developer Center
http://msdn2.microsoft.com/enus/office/bb335345.aspx
Knowledge Base Forums
MSDN Magazine
User Groups
Newsgroups
E-learning Product Evaluations Videos Webcasts V-labs
MSDN Visual How-Tos on Search
Blogs MVPs
Certification Chats
Visit MSDN in the ATE Pavilion and get a FREE 180-day trial of MS Visual Studio Team System!
Resources
Technical Communities, Webcasts, Blogs, Chats & User Groups http://www.microsoft.com/communities/default.mspx Microsoft Learning and Certification http://www.microsoft.com/learning/default.mspx
learn support
connect subscribe
MSDN Library
Microsoft Developer Network (MSDN) & TechNet http://microsoft.com/msdn http://microsoft.com/technet
Trial Software and Virtual Labs http://www.microsoft.com/technet/downloads/trials/defa ult.mspx New, as a pilot for 2007, the Breakout sessions will be available post event, in the TechEd Video Library, via the My Event page of the website
Knowledge Base Forums
MSDN Magazine
User Groups
Newsgroups
E-learning Product Evaluations Videos Webcasts V-labs
Blogs MVPs
Certification Chats
Visit MSDN in the ATE Pavilion and get a FREE 180-day trial of MS Visual Studio Team System!
Complete your evaluation on the My Event pages of the website at the CommNet or the Feedback Terminals to win!
All attendees who submit a session feedback form within 12 hours after the session ends will have the chance to win the very latest HTC 'Touch' smartphone complete with Windows Mobile 6 Professional
2007 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.