programming and customizing search in (moss) 2007

34
OFF311 - Programming and Customizing Search in Microsoft Office SharePoint Server (MOSS) 2007 Patrick Tisseghem Managing Partner U2U

Upload: imounz

Post on 27-Aug-2014

120 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Programming and Customizing Search in (MOSS) 2007

OFF311 - Programming and Customizing Search in Microsoft Office SharePoint Server (MOSS) 2007Patrick TisseghemManaging Partner U2U

Page 2: Programming and Customizing Search in (MOSS) 2007

Session Prerequisites• Power User and/or Administration Skills MOSS

2007 Search Features• .NET Development• XML and XSLT Basic Skills

Page 3: Programming and Customizing Search in (MOSS) 2007

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

Page 4: Programming and Customizing Search in (MOSS) 2007

Index and Search Architecture

Web Sites

SharePoint Sites

Network Shares

User Profiles

Business Data

Lotus Notes

...

Protocol Handlers & IFilters

SearchDB

Property

Store

IndexFile

SSP SearchEngine

Search CenterSmall Search Box

IndexEngine

Search Object Model + Web Services + Custom Security Trimmers

Search Administration Object Model

Page 5: Programming and Customizing Search in (MOSS) 2007

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

Page 6: Programming and Customizing Search in (MOSS) 2007

Search Administration OM

ServerContext SearchContext

Content

Schema

Scopes

Keyword

Ranking

Propagation

LogViewer

Microsoft.Office.Server.Search.dll

Microsoft.Office.Server.dll

Page 7: Programming and Customizing Search in (MOSS) 2007

Server and Search Context• Use ServerContext class to connect to the

context of the Shared Services Provider

• Use SearchContext class to connect to the context of the Search Service

ServerContext srvctx = ServerContext.GetContext(SSPName);

SearchContext searchctx = SearchContext.GetContext(srvctx);

Page 8: Programming and Customizing Search in (MOSS) 2007

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

Page 9: Programming and Customizing Search in (MOSS) 2007

DemoProgramming with the Search Administration Object Model

Page 10: Programming and Customizing Search in (MOSS) 2007

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

Page 11: Programming and Customizing Search in (MOSS) 2007

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

Page 12: Programming and Customizing Search in (MOSS) 2007

DemoCustom Search Center Page Layouts

Page 13: Programming and Customizing Search in (MOSS) 2007

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

Page 14: Programming and Customizing Search in (MOSS) 2007

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

Page 15: Programming and Customizing Search in (MOSS) 2007

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)

Page 16: Programming and Customizing Search in (MOSS) 2007

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

Page 17: Programming and Customizing Search in (MOSS) 2007

Web Parts on Advanced Search Page• AdvancedSearchBox

• Different search boxes• Language picker• Scope picker• ResultType picker• Property picker

Page 18: Programming and Customizing Search in (MOSS) 2007

DemoCustomizing and Programming with the Search Web Parts

Page 19: Programming and Customizing Search in (MOSS) 2007

XSLT• Rendering of

search results is driven by XSLT

• XSL and XSLLink property

• Base class is DataFormWebPart

Page 20: Programming and Customizing Search in (MOSS) 2007

DemoCustom XSLT for the Search Core Results Web Part

Page 21: Programming and Customizing Search in (MOSS) 2007

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

Page 22: Programming and Customizing Search in (MOSS) 2007

DemoCustom Tabs for the Search Center

Page 23: Programming and Customizing Search in (MOSS) 2007

Search Query Object Model

Query Engine

Query Engine

DefinitionsResultTable- IDataReader

Relevance

High Confidence

Best Bets

Keyword syntax

SQL Syntax

QueryClient Application

Browser or ClientResults UI

Query Object Model & Web Service

Page 24: Programming and Customizing Search in (MOSS) 2007

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

Page 25: Programming and Customizing Search in (MOSS) 2007

The Query Object Model

Query

FullTextSqlQuery

KeywordQuery

• Microsoft.Office.Server.Search.dll• Microsoft.Office.Server.Search.Query namespace

Page 26: Programming and Customizing Search in (MOSS) 2007

DemoCustom Search Box Web Part

Page 27: Programming and Customizing Search in (MOSS) 2007

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

Page 28: Programming and Customizing Search in (MOSS) 2007

DemoRemote searching

Page 29: Programming and Customizing Search in (MOSS) 2007

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

Page 30: Programming and Customizing Search in (MOSS) 2007

DemoBuilding and Deploying Custom Security Trimmer

Page 31: Programming and Customizing Search in (MOSS) 2007

Resources• MS Press Books

• ‘Inside MOSS 2007’ (Patrick Tisseghem)• ‘Inside Indexing and Search Engine:

MOSS 2007’ (Patrick Tisseghem and Lars Fastrup)

• MSDN Enterprise Search Developer Centerhttp://msdn2.microsoft.com/en-us/office/bb335345.aspx

• MSDN Visual How-To’s on Search

MSDN Library Knowledge

Base Forums MSDN Magazine User

Groups Newsgroup

sE-learning

Product Evaluations Videos

Webcasts V-labs Blogs MVPs

Certification Chats

learnsupportconnectsubscribe

Visit MSDN in the ATE Pavilion and get a FREE 180-day trial of MS Visual Studio Team System!

Page 32: Programming and Customizing Search in (MOSS) 2007

Resources• Technical Communities, Webcasts, Blogs, Chats

& User Groupshttp://www.microsoft.com/communities/default.mspx

• Microsoft Learning and Certificationhttp://www.microsoft.com/learning/default.mspx

• Microsoft Developer Network (MSDN) & TechNet http://microsoft.com/msdn http://microsoft.com/technet

• Trial Software and Virtual Labshttp://www.microsoft.com/technet/downloads/trials/default.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

MSDN Library Knowledge

Base Forums MSDN Magazine User

Groups Newsgroup

sE-learning

Product Evaluations Videos

Webcasts V-labs Blogs MVPs

Certification Chats

learnsupportconnectsubscribe

Visit MSDN in the ATE Pavilion and get a FREE 180-day trial of MS Visual Studio Team System!

Page 33: Programming and Customizing Search in (MOSS) 2007

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

Page 34: Programming and Customizing Search in (MOSS) 2007

© 2007 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.