Download presentation
Presentation is loading. Please wait.
Published byJerome Moody Modified over 9 years ago
2
SRC303: Search in Microsoft Office SharePoint Server 2007: Customizing and Extending Zlatan Dzinic Principal Consultant Business Connexion
3
Session Objectives And Key Takeaways Session Objective(s) Learn how to customize SharePoint Server Search 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
4
Agenda Customize the Product UI Branding Search Center Web parts XSLT Extending search Query Object Model Web Service for remote apps Indexing Custom Data, BDC Wrap up and questions
5
Branding the SharePoint UI Built on ASP.NET 2.0 master pages control look and feel of the website Custom CSS SharePoint Designer Build master pages Design CSS
6
Core Results Matching Keywords And Best Bets High Confidence Action Links Search Tabs Search Center Search Box Pagination Statistics
7
Search Tabs 2 tabs OOB All Sites tab (standard scope) People tab Extensible Custom tabs can be added for additional data types / custom search experience Consists of a layout page and a results page Not available in MOSS for Search
8
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
9
Some simple customizations Customize Thesaurus Located at drive:\Program Files\Microsoft Office Servers\12.0\Data\Config TSxxx.xml where xxx is the lang code Replacement or Expansion sets Eg. Replace “Yukon” with “SQL Server 2005” Eg. Expand “Tom” with “good-looking”, “tall” and “great speaker” Substitution weighs and stemming is supported Best bets Setup best bets at the Site collection level
10
Some more customizations Simple things you can do for relevance: Authoritative pages Demoted sites With a little bit of code: Available only through the OM Changing weighting of properties If you’re a little crazy: Changing ranking parameters through code Eg. Saturation constant for term frequency
11
Customize UI With XSLT Appropriate for scenarios requiring Change results layout, look and feel Pivoting using the keyword syntax Web part property Power of XSLT FormattingLogicMath
12
Walk through of the XSLT Parameter Section Parameters passed by results, web part properties No Keyword Section You didn’t enter a keyword No Results Section No results were returned Customize with your own message to help users Main Body Result Section The meat Results Template Section Matches results in XML Selected column matching – Title, URL, etc. Hit Highlighting, Auto definition
13
Customizing Search Web Parts Change Look and Feel Search Tabs Search Web Parts Customizing with XSLT
14
Extending Search Query Object Model Query Syntax Web Service for remote apps Indexing Custom Data Business Data Search
15
Query Object Model Use query OM To build custom search UI web parts To have direct access to query and results properties To invoke custom queries 2 types of query syntaxes KeywordSQL URL Request Parameters
16
Query Object Path Query OM Input Output SQL Query OptionalParameters Site UI Custom Client Local Remote Keyword Query Results Query
17
Use Case end user Leverage customization (i.e. write pivoting in XSLT) Simple and easy to use Avoids parsing and construction of SQL Required and excluded term support Bike –fitness SharePoint search -authur:”Richard Riley” Filter by any string or integer property Consistent property:value syntax across Office, Windows and Live search Query Syntax Keyword Syntax gallery hinges –brass site:http//supportdesk scope:Products
18
Use Case Advanced search solutions Complex queries Consistent SQL across enterprise and desktop Query Syntax SQL Syntax SELECT URL, Title, Description FROM portal_content..SCOPE() WHERE FREETEXT(‘gallery hinges’) AND SITE = “http://supportdesk” AND SCOPE = “Products” AND NOT CONTAINS(‘brass’)
19
Full strength, complete coverage freetext() Arbitrary groupings for AND, OR, NOT CONTAINS()LIKE ORDER BY ASC | DESC Removed in MOSS 2007 UNION ALL MATCHES SELECT * COALESCE TABLE COALESCE TABLE Query Syntax Query Syntax SQL Syntax
20
Query Syntax Use Case Launching a URL in custom application Save searches Keywords results.aspx?k=fish Scopes results.aspx?k=fish&s=BBC Sort/View results.aspx?v=date results.aspx?v=relevance Page results.aspx?start=21 Property matching results.aspx?k=“fish author:Tom –site:http://mysite.com” Request Parameters URL Request Parameters
21
Query Object Model Features Managed code API Single request – multiple results Result Types Relevant results High confidence results Special terms Definitions Optional parameters # of Sentences in Summary Implicit - AND/OR Number of results Ignore noise words Enable stemming Language
22
Query OM Input Output SQL Query Query Engine Result Table Collection ResultTable: IDataReader Relevant results High confidence Special terms Definitions Site UI Custom Client Execute() Keyword Query Optional Parameters Local Query Object Path
23
Same flow, keyword or SQL syntax Set up query text and options Execute() Retrieve a set of IDataReader objects Query Object Model
24
Using the Query Object Model
25
Query Web Service Use Case Remote application ASP.Net 2.0 or any other app… Office Research Pane Windows Live Search Center Similar features as query object model Results in XML and data table formats http://o12server/_vti_bin/search.asmx http://msdn2.microsoft.com/en- us/library/ms559279.aspx
26
Query Web Service Methods Query – returns results as XML format Research and Reference Service- compatible XML Use in the Office Research pane QueryEx – Returns.NET DataSet Full set of result types, features GetSearchMetaData – Retrieve available properties and scopes RegistrationStatus
27
Query Web Service
28
Finding People View by relevance or social distance Refine results using various properties
29
Finding People People Search Implements the core results Customizes the search experience Refine by Job Title/ Department Sort by social distance Display results differently
30
Indexing Custom Data Business Data Search Search Data, not only documents Organizations store a lot of their data in SAP, Siebel… But vertical applications lack full-text search Most users can’t locate or access vertical apps Hard to crawl business data with SharePoint MOSS 2007 This proprietary data is accessed through the Business Data Catalog BDC then exposes this data to many features in SharePoint Search can easily index the data: No need to write IFilters or protocol handlers No need to create HTML representations of data Highly customizable results Integrated with scopes and search center
31
Business Data Catalog
32
Indexing Custom Data Index the Business Data Catalog Highest integration without writing code Expose data as HTML/XML via HTTP Develop a Protocol Handler to gather data from 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 2003 MSDN: ISearchProtocol and IUrlAccessor
33
Indexing Custom Data Develop IFilter for custom file formats Reads a document and extracts the plain text content and properties for the indexer to index Support reading from streams Make sure IFilters can run multi-threaded
34
Wrap Up And Questions
35
Links Community Site –www.informationworker.co.zawww.informationworker.co.za My Blog –http://dotnet.org.za/zlatanhttp://dotnet.org.za/zlatan My Website –www.zlatandzinic.comwww.zlatandzinic.com
36
Thank you http://www.microsoft.com/southafrica/ucs/2007
37
Metadata Business Data Catalog Web Parts ListsSearch User Profiles Custom Apps Database WS Proxy ADO.NET Web Service SQL Server, Oracle, OLEDB, ODBC Microsoft BizTalk, SAP, Siebel, Legacy, … List store SearchIndex Profile Store Business Data Catalog (BDC) Connects Office servers to business data
38
POST or GET search results page Query.Execute() Get Doc IDs from index, Properties from search DB Return results in set of IDataReader objects 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 Build links with URL parameters Transform Render Transform Render Change the transform Edit style sheets Write custom Web Parts to OM Results Page Information Flow Browser Server Search OM Service
39
39 Query Code Sample Construct and issue a query KeywordQuery request = new KeywordQuery(ServerContext.Current.SharedResourceProvider.Application Id.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 properties request.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();
40
40 Code Sample Read Result Types using Microsoft.Office.Server.Search.Query; using Microsoft.Office.Server.Search.Query; ReadResults(myResult) ReadResults(myResult) { // Relevant results { // Relevant results ResultTable mySearchResults = myResult[ResultType.RelevantResults]; ResultTable mySearchResults = myResult[ResultType.RelevantResults]; Response.Write("SEARCH RESULTS"); Response.Write("SEARCH RESULTS");ReadResultTable(mySearchResults); // Best bet results // Best bet results ResultTable myBestBets = myResult[ResultType.SpecialTermResults]; ResultTable myBestBets = myResult[ResultType.SpecialTermResults]; Response.Write("BEST BETS"); Response.Write("BEST BETS"); ReadResultTable(myBestBets); ReadResultTable(myBestBets); }
41
41 Code Sample Read Results using Microsoft.Office.Server.Search.Query; void ReadResultTable(ResultTable rt) { while (true == rt.Read()) { Response.Write("\nrow # " + j++); for (int i = 0; i < rt.FieldCount; i++) { String columnName = rt.GetName(i); String columnName = rt.GetName(i); Object columnValue = rt.GetValue(i); Object columnValue = rt.GetValue(i); Type columnType = rt.GetFieldType(i); Type columnType = rt.GetFieldType(i); if (null == columnValue) columnValue = "empty"; if (null == columnValue) columnValue = "empty"; Response.Write(columnName + " : " + columnValue.ToString() + "(type - " + columnType + ") “ ); Response.Write(columnName + " : " + columnValue.ToString() + "(type - " + columnType + ") “ );}}}
42
Search changes ElementDescription COALESCE_TABLE function Removed. Queries using this function will need to be re- written. Column Weighting Removed. If present in queries to Office SharePoint Search, it will be ignored. Rank Modification Removed. If present in queries to Office SharePoint Search, it will be ignored. UNION ALL element Removed. If present in queries to Office SharePoint Search, it will be ignored. MATCHES predicate Removed. Queries using this predicate will need to be rewritten. FROM Specifying a search scope in the FROM clause is no longer supported. Enterprise Search only supports the following FROM clause syntax: …FROM scope()… Support for keyword syntax in search queries has been added to Office SharePoint Server 2007 search. For more information, see the Keyword Query Syntax reference.
43
43 Advanced Search Web Part All, Any, Phrase, Exclusions Filter by language Configurable properties Each control configurable
44
Thank you http://www.microsoft.com/southafrica/ucs/2007
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.