src303: search in microsoft office sharepoint server 2007: customizing and extending zlatan dzinic...
TRANSCRIPT
SRC303: Search in Microsoft Office SharePoint Server 2007: Customizing and ExtendingZlatan DzinicPrincipal ConsultantBusiness Connexion
Session Objectives And Key Takeaways
Session Objective(s) Session Objective(s) Learn how to customize SharePoint Server Learn how to customize SharePoint Server Search UI and build Search based applicationsSearch UI and build Search based applications
• Prerequisites– Basic level of understanding of search in MOSS
2007– Some coding– A bunch of HTML, CSS, ASP.NET and XSLT
Agenda
Customize the Product UICustomize the Product UIBranding Branding Search CenterSearch CenterWeb partsWeb partsXSLTXSLT
Extending search Extending search Query Object ModelQuery Object ModelWeb Service for remote appsWeb Service for remote appsIndexing Custom Data, BDCIndexing Custom Data, BDC
Wrap up and questionsWrap up and questions
Branding the SharePoint UI
Built on ASP.NET 2.0 Built on ASP.NET 2.0 master pages control look and feel of master pages control look and feel of the websitethe website
Custom CSSCustom CSSSharePoint DesignerSharePoint Designer
Build master pagesBuild master pagesDesign CSSDesign CSS
CoreResults
MatchingKeywordsAndBest Bets
HighConfidence
ActionLinks
SearchTabs
Search Center
Search Box
PaginationStatistics
Search Tabs
2 tabs OOB2 tabs OOBAll Sites tab (standard scope)All Sites tab (standard scope)
People tabPeople tab
Extensible Extensible Custom tabs can be added for additional data Custom tabs can be added for additional data types / custom search experiencetypes / custom search experience
Consists of a layout page and a results pageConsists of a layout page and a results page
Not available in MOSS for Search Not available in MOSS for Search
Search Web Parts
• 9 OOB web parts including – Search Box– Core Results– High Confidence– Statistics– Pagination– Action Links– Matching Keywords and Best Bets– Search Summary (Did you mean?)– Advanced Search– Share data through hidden object
• Web part properties such as– Formatting– From turning stemming on/off to the # of results returned – XSL
Some simple customizations
Customize ThesaurusLocated at drive:\Program Files\Microsoft Office Servers\12.0\Data\ConfigTSxxx.xml where xxx is the lang codeReplacement or Expansion setsEg. Replace “Yukon” with “SQL Server 2005”Eg. Expand “Tom” with “good-looking”, “tall” and “great speaker”Substitution weighs and stemming is supported
Best betsSetup best bets at the Site collection level
Some more customizations
Simple things you can do for relevance:
Authoritative pagesDemoted sites
With a little bit of code:Available only through the OMChanging weighting of properties
If you’re a little crazy:Changing ranking parameters through code
Eg. Saturation constant for term frequency
Customize UI With XSLT
Appropriate for scenarios requiringAppropriate for scenarios requiringChange results layout, look and feelChange results layout, look and feel
Pivoting using the keyword syntaxPivoting using the keyword syntax
Web part propertyWeb part property
Power of XSLT Power of XSLT FormattingFormatting
Logic Logic
MathMath
Walk through of the XSLTParameter Section
Parameters passed by results, web part properties
No Keyword SectionYou didn’t enter a keyword
No Results SectionNo results were returned
Customize with your own message to help users
Main Body Result SectionThe meat
Results Template SectionMatches results in XML
Selected column matching – Title, URL, etc.
Hit Highlighting, Auto definition
Extending Search
Query Object ModelQuery Object ModelQuery SyntaxQuery Syntax
Web Service for remote appsWeb Service for remote apps
Indexing Custom Data Indexing Custom Data Business Data SearchBusiness Data Search
Query Object Model
Use query OMUse query OMTo build custom search UI web partsTo build custom search UI web parts
To have direct access to query and results To have direct access to query and results propertiesproperties
To invoke custom queriesTo invoke custom queries
2 types of query syntaxes2 types of query syntaxesKeywordKeyword
SQLSQL
URL Request ParametersURL Request Parameters
Query Object Path
Query OMQuery OM
InputInput OutputOutput
SQL SQL QueryQuery
OptionalOptional
ParametersParameters
Site UISite UI
Custom ClientCustom Client
LocalLocal
RemoteRemote
Keyword Keyword QueryQuery
ResultsResultsQueryQuery
Use CaseUse Caseend userend user
Leverage customization (i.e. write pivoting in Leverage customization (i.e. write pivoting in XSLT)XSLT)
Simple and easy to useSimple and easy to useAvoids parsing and construction of SQLAvoids parsing and construction of SQL
Required and excluded term supportRequired and excluded term supportBike –fitness Bike –fitness
SharePoint search -authur:”Richard Riley”SharePoint search -authur:”Richard Riley”
Filter by any string or integer propertyFilter by any string or integer property
Consistent property:value syntax across Consistent property:value syntax across Office, Windows and Live searchOffice, Windows and Live search
Query SyntaxKeyword Syntax
gallery hinges gallery hinges ––brass site:http//supportdesk scope:Productsbrass site:http//supportdesk scope:Products
Use CaseUse CaseAdvanced search solutionsAdvanced search solutions
Complex queriesComplex queries
Consistent SQL across enterprise and Consistent SQL across enterprise and desktopdesktop
Query SyntaxSQL Syntax
SELECT URL, Title, DescriptionSELECT URL, Title, DescriptionFROM portal_content..SCOPE()FROM portal_content..SCOPE()WHERE FREETEXT(‘gallery hinges’)WHERE FREETEXT(‘gallery hinges’)AND SITE = “http://supportdesk”AND SITE = “http://supportdesk”AND SCOPE = “Products”AND SCOPE = “Products”AND NOT CONTAINS(‘brass’) AND NOT CONTAINS(‘brass’)
Full strength, complete coverageFull strength, complete coveragefreetext()freetext()
Arbitrary groupings for AND, OR, NOTArbitrary groupings for AND, OR, NOT
CONTAINS()CONTAINS()
LIKELIKE
ORDER BY ASC | DESCORDER BY ASC | DESC
Removed in MOSS 2007Removed in MOSS 2007UNION ALL UNION ALL
MATCHESMATCHES
SELECT *SELECT *
COALESCE TABLE COALESCE TABLE
Query SyntaxQuery SyntaxSQL SyntaxQuery SyntaxQuery SyntaxSQL Syntax
Query SyntaxQuery Syntax
Use CaseLaunching a URL in custom applicationSave searches
Keywordsresults.aspx?k=fish
Scopesresults.aspx?k=fish&s=BBC
Sort/Viewresults.aspx?v=date results.aspx?v=relevance
Pageresults.aspx?start=21
Property matchingresults.aspx?k=“fish author:Tom –site:http://mysite.com”
URL Request ParametersRequest Parameters
Query Object ModelFeatures
Managed code APIManaged code API
Single request – multiple resultsSingle request – multiple results
Result TypesResult TypesRelevant resultsRelevant results
High confidence High confidence resultsresults
Special termsSpecial terms
DefinitionsDefinitions
Optional parametersOptional parameters# of Sentences in # of Sentences in SummarySummary
Implicit - AND/ORImplicit - AND/OR
Number of resultsNumber of results
Ignore noise wordsIgnore noise words
Enable stemmingEnable stemming
LanguageLanguage
Query OMInput Output
SQLQuery
QueryEngine
Result Table CollectionResultTable:IDataReader
Relevantresults
Highconfidence
Specialterms
Definitions
Site UI
CustomClientExecute()
KeywordQuery
OptionalParameters
Local
Query Object PathQuery Object Path
Same flow, keyword or SQL syntaxSame flow, keyword or SQL syntax
Set up query text and optionsSet up query text and options
Execute()Execute()
Retrieve a set of IDataReader objectsRetrieve a set of IDataReader objects
Query Object Model
Query Web ServiceUse CaseUse Case
Remote application Remote application
ASP.Net 2.0 or any other app…ASP.Net 2.0 or any other app…
Office Research PaneOffice Research Pane
Windows Live Search CenterWindows Live Search Center
Similar features as query object modelSimilar features as query object model
Results in XML and data table formatsResults in XML and data table formats
http://o12server/_vti_bin/search.asmxhttp://o12server/_vti_bin/search.asmx
http://msdn2.microsoft.com/en-us/library/http://msdn2.microsoft.com/en-us/library/ms559279.aspxms559279.aspx
Query Web ServiceMethodsMethods
Query – returns results as XML formatQuery – returns results as XML format
Research and Reference Service-Research and Reference Service-compatible XMLcompatible XML
Use in the Office Research paneUse in the Office Research pane
QueryEx – QueryEx –
Returns .NET DataSetReturns .NET DataSet
Full set of result types, featuresFull set of result types, features
GetSearchMetaData – Retrieve available GetSearchMetaData – Retrieve available properties and scopesproperties and scopes
RegistrationRegistration
StatusStatus
Finding PeopleFinding People
View byrelevance or
social distanceRefine results using various properties
Finding PeopleFinding People
People Search Implements the core resultsCustomizes the search experience
Refine by Job Title/ Department
Sort by social distance
Display results differently
Indexing Custom DataBusiness Data Search
Search Data , not only documentsSearch Data , not only documentsOrganizations store a lot of their data in SAP, Organizations store a lot of their data in SAP, Siebel…Siebel…
But vertical applications lack full-text searchBut vertical applications lack full-text searchMost users can’t locate or access vertical appsMost users can’t locate or access vertical appsHard to crawl business data with SharePointHard to crawl business data with SharePoint
MOSS 2007MOSS 2007This proprietary data is accessed through the This proprietary data is accessed through the Business Data CatalogBusiness Data CatalogBDC then exposes this data to many features in SharePointBDC then exposes this data to many features in SharePoint
Search can easily index the data:Search can easily index the data:No need to write IFilters or protocol handlersNo need to write IFilters or protocol handlersNo need to create HTML representations of dataNo need to create HTML representations of dataHighly customizable resultsHighly customizable resultsIntegrated with scopes and search centerIntegrated with scopes and search center
Indexing Custom DataIndex the Business Data CatalogIndex the Business Data Catalog
Highest integration without writing codeHighest integration without writing code
Expose data as HTML/XML via HTTPExpose data as HTML/XML via HTTP
Develop a Protocol Handler to gather data Develop a Protocol Handler to gather data from custom repositoriesfrom custom repositories– Connects to a content source and enumerates
the documents– Ships with support for
• Web Content, NTFS File Shares, Exchange Public Folders, Lotus Notes Databases, SharePoint Content, SharePoint profiles, Business Data Catalog
Interfaces are the same as in SPS 2003Interfaces are the same as in SPS 2003
MSDN: MSDN: ISearchProtocolISearchProtocol and and IUrlAccessorIUrlAccessor
Indexing Custom Data
Develop Develop IFilterIFilter for custom file formats for custom file formatsReads a document and extracts the plain text content and properties for the indexer to index
Support reading from streamsSupport reading from streams
Make sure IFilters can run multi-threadedMake sure IFilters can run multi-threaded
Links
• Community Site– www.informationworker.co.za
• My Blog– http://dotnet.org.za/zlatan
• My Website– www.zlatandzinic.com
Thank you
http://www.microsoft.com/southafrica/ucs/2007
MetadatMetadataa
Business Data Business Data CatalogCatalog
Web Web PartsParts ListsLists SearchSearch User User
ProfilesProfilesCustom Custom AppsApps
DatabaseDatabase
WS WS ProxyProxy
ADO.NEADO.NETT
Web Web ServiceService
SQL Server, Oracle, OLEDB, ODBCSQL Server, Oracle, OLEDB, ODBCMicrosoft BizTalk, SAP, Siebel, Legacy, …Microsoft BizTalk, SAP, Siebel, Legacy, …
List List storestore
SearcSearchhIndexIndex
ProfileProfile StoreStore
Business Data Catalog (BDC)Connects Office servers to business data
POST or GETsearch results
page
Query.Execute()Query.Execute()
Get Doc IDs from index,Properties from search DB
Get Doc IDs from index,Properties from search DB
Return results in set of IDataReader objects
Return results in set of IDataReader objects
Wrap results in XML
Wrap results in XML
•CSS applied•Client-side code runs
Get query, scope from request parameters
Get query, scope from request parameters
Get SELECT list from tool pane
Get SELECT list from tool pane
Build links withURL
parameters
Build links withURL
parameters
TransformRender
TransformRender
Change the transform
Edit style sheets
Write custom Web Parts to
OM
Results Page Information FlowBrowserBrowser
ServerServer
Search OMSearch OM
ServiceService
39
Query Code SampleConstruct and issue a query
KeywordQuery request = new KeywordQuery(ServerContext.Current.SharedResourceProvider.ApplicationId.ToString());
Request.QueryText = textSearchBox.Text// append other keyword filters
request.HiddenConstraints = "scope:" + "\"Customers\"";request.ResultTypes |= ResultType.RelevantResults;request.ResultTypes |= ResultType.SpecialTermResults;// append requests for other result sets
// set query propertiesrequest.HighlightedSentenceCount = 3;request.TotalRowsExactMinimum = 50;
// add/remove selected properties
SPSite site = new SPSite(Page.Request.Url.ToString());request.SiteContext = site.ID.ToString();
ResultTableCollection myResult = request.Execute();
43
Advanced Search Web Part
All, Any, Phrase, All, Any, Phrase, ExclusionsExclusions
Filter by languageFilter by language
Configurable Configurable propertiesproperties
Each control Each control configurableconfigurable
Thank you
http://www.microsoft.com/southafrica/ucs/2007