Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005
Extending And Enhancing The Sharepoint Portal Server Search User Interface Nigel Bridport Principal Consultant Microsoft Corporation
Agenda Two Search Engines Site Context Search Box Enhancing the code on MSDN Enhancing the results
Two Search Engines Windows SharePoint Services Uses SQL Full-text search engine Enabled by default Site-level search Allows search for standalone WSS installations SharePoint Portal Server Uses SharePointPSSearch service Indexing technology first introduced in V2001 Protocol Handler/IFilter support Content Sources
Two Search Engines Searches for WSS WSS SPS SPS List items YesYes DocumentsYesYes ListsYesYes Boolean searches (AND, OR, Near, NOT) NoYes* File types other than.doc,.xls,.ppt,.txt, and.htm Not by default* Yes* Subsite content on a top-level Web site No*Yes Non-text list fields (such as currency, number, lookup, Yes/No) NoYes Attachments to lists NoYes File properties (such as Author and Company) used by Microsoft Office 2003 documents NoYes Survey lists NoYes Hidden lists No (by design) Site administrators, site groups, users, or cross-site groups NoNo External Web sites, file shares, documents NoYes Narrowed search results accomplished by searching through previous results NoNo Displaying the total number of items matching a search string NoYes*
Site Context Search Box Problem Statement Users want to execute searches on Windows SharePoint Services enabled sites and have the results returned from all sub sites in the collection
Site Context Search Box Prototyped Options SearchResults.aspx List items, Documents, Paging, Searches within views ‘Search for “x” on Portal’ does NOT have site context so results are returned from All Sources Links created with site context required two clicks Inherit SPS Search Box Microsoft.SharePoint.Portal.WebControls.SearchBox Expects Portal Context to render – not Site Context Inherit WSS Search box Microsoft.SharePoint.WebControls.ViewSearchForm No public interface for Controls tree 3rd Party Tools
Site Context Search Box Custom Control Preferred Solution Statement Combine the functionality and look-and-feel of the site-level search box and the portal-level search box to create a custom site context search box
Site Context Search Box Building the Query GET Parameters for Search.aspx KEYWORD WHERE clause DAV:href = SPWeb.ServerRelativeUrl CONTAINS ignores ‘/’ character – no way to exclude sibling sites LIKE honors ‘/’ character – but too slow to execute Combine the CONTAINS and LIKE clauses
Building The Query
Site Context Search Box Rendering the Control Control Layout Advanced Search button Scope drop-down Keywords text box Execute Search button Theme aware CssClass property Spacer columns Client-side Script Execute search without posting back to server Append Keyword to query string Handle tag rendering Hover Images for Go arrow
Rendering The Control
Agenda Enhancing the code on MSDN IE Menu (HtcMenu) in place of DropDown Box Optional XML Configuration File Enhancing the results Boolean Logic Hit Highlighting (in search results) Wildcard support
Enhancing The MSDN Code Features HtcMenu Grouped search scopes Standard SharePoint Look XML Configuration File Add additional SharePoint Portals to your search
Extending The MSDN Code
Enhancing The Results Boolean Logic Accepting AND/OR/ NOT OOB SPS Defaults to OR Enhanced Results modifies the query Processes AND, OR, NOT Allows for nested Boolean logic
Enhancing the Results Additional features Enhanced List Item Results Passes query to WSS Search Gets list item level details Does not work well with Boolean/wildcard search Hit Highlighting Highlights search terms in search results JavaScript based Wildcard Support Allows for wild card at the end of a word Option to disable/enable feature
Enhancing The Results Notes Design Decisions Enhanced Results inherits from SearchResults Keeps same look and feel as OOB search results Ranking Ranking is identical to OOB search results Search query/ranking customizable via code List Item Results Overrides GenerateHtmlOneRowForOneItem Adds “Enhance Results” link to output
Enhanced Results
Developer Resources Create a Site Context Search Box that Uses SharePoint Portal Server Search Results Microsoft SharePointPSSearch SQL Syntax (Preview) Microsoft SharePoint Products and Technologies 2003 Software Development Kit (SDK) SharePoint Portal Server developers' home on MSDN
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.