Home > Sample chapters

Managing the Search Experience in Microsoft SharePoint 2010

Customizing Search Pages

Because the basic three search pages are essentially the same in the Basic and Enterprise search centers, we will first discuss customizing each of these pages and their corresponding Web parts and then discuss the extended customizations available in the Enterprise search center.

Search Web Parts in SharePoint 2010 are based on the federation object model (OM) and are used by both SharePoint Search and FAST Search. The Web parts on a page communicate through a shared query manager identified in the Web parts as the Cross Web Part Query ID. To add new Web parts that interact with existing Web parts, the new Web parts simply need to use the same query ID. Because the out-of-the-box Web parts are no longer sealed, your developers can extend their functionality instead of writing a new one from scratch.

Query Pages

The welcome page of all search centers is a basic query page named default.aspx. Although this page seems rather simple, as shown in Figure 9-45, it supports a number of customization options, even in the basic search center site.

Figure 9-45

Figure 9-45 Portion of the basic query page in edit mode.

The page has two Web part zones but only a single Search Box Web part. You can choose to add other Web parts, such as a content editor where instructions on how to search more effectively can be presented. Because Web parts might be targeted by audience, you can add multiple instances of the same Search Box Web part on the same page customized for different groups of users.

The appearance of the Preferences link is controlled by the Search Box configuration and opens the page shown in Figure 9-46, where users can configure personal preferences for the configuration of the Web part.

Users can choose to prevent the search suggestions from being displayed as they type in query terms. These suggestions are retrieved from the history of queries executed by previous searches. Users can also choose to override the default behavior of searching in the language of the browser and instead choose up to five languages to include in the search results. From that list, they can choose the default language, which is given a higher relevance ranking in the results list.

Figure 9-46

Figure 9-46 Edit User Preferences page for the Search Box Web part.

Search Box Web Part

The search Web parts have many configuration sections in common with other Web parts. Because these are discussed in another chapter of this book, we will not cover those sections. The Search Box Web part is used in both search and results pages and has the same functionality as the search box control on the master pages.

To configure the properties of a Web part on the Search page, perform the following steps:

  1. From the Site Actions menu or the Page ribbon of the page, select Edit Page.

  2. In the Web Part zone, click the small down arrow for the Web part to expose the context menu and select Modify Shared Web Part.

  3. Expand the appropriate sections to configure properties as needed.

  4. Click OK.

  5. For publishing pages, you need to save, check in, and publish the page. For standard pages, the action is simply Stop Editing.

The Scopes Dropdown section of the Search Box Web part is shown in Figure 9-47. The Dropdown mode options are the same as those of the Site Settings Search Settings page discussed earlier. Normally, you do not need to enter text in the Dropdown Label box or modify the default automatic Fixed Dropdown Width setting (0).

Figure 9-47

Figure 9-47 Scopes Dropdown Section of the Search Box Web part properties.

The Query Text Box Label and Query Text Box Label Width text boxes, shown in Figure 9-48, are straightforward. Additional query terms can be added to the user-entered query. This text box is usually empty. The entered text shown in Figure 9-48 limits the results to documents. Any keyword query can be placed here, including scope definitions. Because these terms modify the query transparently to the user, appropriately labeling the query box will inform the user of its functionality. The prompt string will appear in the query box unless the focus is set there automatically or the cursor is placed there manually. The Append Additional Terms To Query check box is critical because the terms entered in this section are not used unless it is selected.

Figure 9-48

Figure 9-48 Query Text Box section of the Search Box Web part properties.

The search query box, shown in Figure 9-49, displays the configurations set in Figure 9-48.

Figure 9-49

Figure 9-49 Customized search query box.

The Query Suggestions section, shown in Figure 9-50, offers global control over the suggestions process, where the preferences page let users specify individual preferences. This section offers more granular control of the search parameters. The Minimum Prefix Length setting determines how many characters must be typed before suggestions are offered. The Suggestion Delay setting controls the response time, and the Number Of Suggestions To Display setting controls the maximum number of suggestions.

Figure 9-50

Figure 9-50 Query Suggestions section of the Search Box Web part properties.

Despite the name, the Miscellaneous section shown in Figure 9-51 is probably the most often used in customizing search. The first two switches, Use Site Dropdown Mode and Use Site Level Defaults, override the settings in the Scope Dropdown section. Use these options to establish centralized control of multiple Web parts from the Search Settings of the site collection.

Figure 9-51

Figure 9-51 Miscellaneous section of Search box Web part properties.

The next two switches control the links at the end of the query box. You might choose not to offer an advanced search page for some searches, such as the People Query page in the Enterprise Search Center. Obviously, if you did not select the Show Query Suggestions check box in the previous section, you also might choose to remove the user preferences link. Remember that user preferences also control query languages.

The next four entries control the Search button images. Although customization of the query Web part does permit appending terms to the query, it does not offer the sophistication of an advanced query Web part, nor can it modify the presentation of results as the various search results Web parts do. We will cover those customizations later in this chapter.

In the Advanced Search Page URL box, you can direct the advanced search link to the appropriate custom page. This text box is active even if the Display Advanced Search Link check box is not selected. The text displayed in this box in Figure 9-51 shows a relative path for a page in a Basic Search Center.

The Target Search Results Page URL setting configures the target page for the query from this search query. Because the actual work of the search query is accomplished by the results page, you might configure custom query pages or custom query Web parts where the only customization is the target results page.

The Display Submitted Search check box affects only query Web parts placed on the results page. If these Web parts display the query submitted to the page, the user can easily modify the query without retyping it in its entirety.

If you need to change the scope display group, you must type the name exactly as it appears in the site collection scope management page.

The Appearance, Layout, and Advanced sections are standard for SharePoint Web parts. If you need to target to audiences, you can find the Audiences configuration in the Advanced section. By having multiple Search Box Web parts targeted to different audiences on the same page, you can have a single query page customized to the user opening it.

Advanced Search Pages

The Advanced Search page of the Basic Search Center has only a single Web part zone, although the advanced search pages of the Enterprise Search Center have two additional zones at the top of the page. In both instances, the pages contain the single advanced search Web part shown in its default configuration in Figure 9-52.

Figure 9-52

Figure 9-52 Default Advanced Search Web part.

Although much of the Web part can be customized easily in the property UI, three critical portions require modifying XML. We will walk through the properties as they appear. To edit the Web part, first place the page in Edit mode from either the Site Actions menu or the Page ribbon. Then to the upper right of the Web part, from the drop-down arrow menu choose Edit Web Part.

The first section of the Advanced Search Web part is shown in Figure 9-53. These Search Box settings affect the query terms. All of these query terms can be entered directly in the basic query box if the user knows how to construct the query. Each option includes a text label box and a selection to enable it.

Figure 9-53

Figure 9-53 Advanced Search Web part properties Search Box section.

The next section, displayed in Figure 9-54, is named Scopes and controls a series of query filters. Again, options are presented for labels with enabling selections. Although the Display Group used by the scope picker is configured within this section, both the Language and Result Type pickers are controlled by an XML section that will be discussed later.

Figure 9-54

Figure 9-54 Advanced Search Web part properties Scopes section.

The Properties section, shown in Figure 9-55, continues to manage query filters using managed properties. An XML string contained in the Properties text box controls the managed properties available for use here, as well as the languages exposed in the language picker and the file types defined in the result type picker.

To edit this code, place the cursor in the text box to expose the blue builder text editor button to the right of the text box. Because the file is a single line in this editor, you might want to copy the entire text to your favorite XML editor, make the changes, and paste the modified text back into the builder for saving to the Properties settings.

Figure 9-55

Figure 9-55 Advanced Search Web part Properties section.

We will examine the portions of this file in the order of appearance. The first section defines the languages supported by search. For each language definition (LangDef), the display name is given in quotes, and the assigned language ID is given in quotes. You do not need to modify this portion. A small portion of the code follows.

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<LangDefs>
  <LangDef DisplayName="Simplified Chinese" LangID="zh-cn" />
  <LangDef DisplayName="Traditional Chinese" LangID="zh-tw" />
  <LangDef DisplayName="English" LangID="en" />
  <LangDef DisplayName="Finnish" LangID="fi" />
  <LangDef DisplayName="French" LangID="fr" />
  <LangDef DisplayName="German" LangID="de" />
  <LangDef DisplayName="Italian" LangID="it" />
  <LangDef DisplayName="Japanese" LangID="ja" />
  <LangDef DisplayName="Spanish" LangID="es" />
</LangDefs>

The next section of the code specifies the languages by LangID to be displayed in the language picker, as shown in the following code sample. To change the languages displayed, simply add or remove lines from these default settings and save the code back to the Properties text box.

<Languages>
  <Language LangRef="en" />
  <Language LangRef="fr" />
  <Language LangRef="de" />
  <Language LangRef="ja" />
  <Language LangRef="zh-cn" />
  <Language LangRef="es" />
  <Language LangRef="zh-tw" />
</Languages>

The next portion of the XML string is the Property Definition section, as shown in the following code block. These properties must be managed properties. Additional property entries must include the real managed property name, the data type, and the name to display in the Web part.

<PropertyDefs>
  <PropertyDef Name="Path" DataType="text" DisplayName="URL" />
  <PropertyDef Name="Size" DataType="integer" DisplayName="Size (bytes)" />
  <PropertyDef Name="Write" DataType="datetime" DisplayName="Last Modified
Date" />
  <PropertyDef Name="FileName" DataType="text" DisplayName="Name" />
  <PropertyDef Name="Description" DataType="text" DisplayName="Description"
/>
  <PropertyDef Name="Title" DataType="text" DisplayName="Title" />
  <PropertyDef Name="Author" DataType="text" DisplayName="Author" />
  <PropertyDef Name="DocSubject" DataType="text" DisplayName="Subject" />
  <PropertyDef Name="DocKeywords" DataType="text" DisplayName="Keywords" />
  <PropertyDef Name="DocComments" DataType="text" DisplayName="Comments" />
  <PropertyDef Name="CreatedBy" DataType="text" DisplayName="Created By" />
  <PropertyDef Name="ModifiedBy" DataType="text" DisplayName="Last Modified
By" />
  </PropertyDefs>

You can add other managed properties to these definitions. Managed properties do not have to be designated for use in a scope to be used in the Advanced Search Web part. After they are defined, these properties can then be used in the result types filter definitions and in the managed properties filters:

<ResultType DisplayName="Word Documents" Name="worddocuments">
  <KeywordQuery>FileExtension="doc" OR FileExtension="docx" OR
FileExtension="dot" OR FileExtension="docm" OR
ileExtension="odt"</KeywordQuery>
  <PropertyRef Name="Author" />
  <PropertyRef Name="DocComments" />
  <PropertyRef Name="Description" />
  <PropertyRef Name="DocKeywords" />
  <PropertyRef Name="FileName" />
  <PropertyRef Name="Size" />
  <PropertyRef Name="DocSubject" />
  <PropertyRef Name="Path" />
  <PropertyRef Name="Write" />
  <PropertyRef Name="CreatedBy" />
  <PropertyRef Name="ModifiedBy" />
  <PropertyRef Name="Title" />
  </ResultType>

There are result types for the following categories:

  • Default

  • Documents

  • Word Documents

  • Excel Documents

  • Presentations

You can enter new managed properties as property definitions, and then create new result types or modify existing ones in this file. After you edit the string, save it back into the Property text box

The Miscellaneous section contains a single, but very important, setting for the target results URL, as shown in Figure 9-56. In particular, a custom Advanced Query Web part might need to point to a custom results page where the presentation of the results Web parts has been customized to meet business needs. This custom results page can also contain non-search Web parts that connect to the search Web parts.

Figure 9-56

Figure 9-56 Advanced Search Web part Miscellaneous section.

A sample search query constructed by the advanced search Web part can be passed as the following:

ALL(searchterm) (DetectedLanguage="en") (IsDocument="True")
Write>=02/01/2010

A knowledgeable user can enter the search in a basic query box as the following and achieve the same results:

searchterm DetectedLanguage="en" IsDocument="True" Write>=02/01/2010

However, most users will find the UI of the advanced search easier to use.

Results Pages

The results pages are the most complex of the three default search pages, with a total of eight Web part zones and up to 12 Web parts, depending on the results page type. Each of these Web parts is responsible for a different view of the results or information about the results. Figure 9-57 displays the default results page from the Enterprise Search Center.

Figure 9-57

Figure 9-57 Results page from Enterprise Search Center.

The People Search Results page, shown in Figure 9-58, shares six of the same Web parts, but with different configurations.

Figure 9-58

Figure 9-58 People Search Results page.

Two Web parts are not displaying on the People Search Results page. The Summary Web part displays only to suggest search terms when the query contains a term that is only close to those contained in the index, such as misspelled words. Despite its name, the results appear prefaced with “Did you mean,” as shown in Figure 9-59.

Figure 9-59

Figure 9-59 Summary Web part.

The People Search Results page does not need this Web part because the fuzzy logic and phonetic searches in people searches make the corrections for the user. In Figure 9-58, the search term “li” retrieved people named “Lee” and “Low.”

The Related Queries Web part is located in the zone on the right of the results page, and it suggests other search terms that have been used and contains terms within the current query.

Results Pages Functionality

Core Results Web parts and their derivatives instantiate an object called the Query Manager and send their query requirements to their Query Manager. These Web parts all have a Cross-Web Part Query ID property that identifies the Query Manager that they share.

The Query Manager object executes the query for local results, receives the search results as XML data, and passes the appropriate results to the different search Web parts on the results page. The content and format of the XML data that is passed depends on the Web part that is receiving the data based upon the parameters originally sent to the Query Manager. Each Web part then displays the XML data, formatted according to the XSL Transform specified for that Web part’s XSL property.

Federated Results Web parts using OpenSearch 1.1 pass the query to the target search engine directly and format the results according to the XSL configured for the Web part. Because these Web parts are not participating with the Query Manager, they can load asynchronously.

Search Web Parts Configurations

Search Web parts have many configurations that are common to all SharePoint Web parts. Because those were covered in Chapter 7, we will not include those in this discussion. Our focus will be the configurations that are unique to each Web part or that affect the functionality of the Web part. Because FAST Search for SharePoint uses the same Web parts, there seem to be some options that have functionality only with that product.

Search Core Results

This same Web part with different configurations is used in multiple locations on results pages. We will show only the properties of the Core Search Results from the Results.aspx and indicate the variations between that and the People Core Results and Search Action Links uses.

  • Location Properties. Because SharePoint Server 2010 search uses the Federated Search object model, the first section is Location Properties, which is shown in Figure 9-60. For Core Results, the location is Local Search Results as defined in Federated Search Locations. For both People Search Results and Search Action Links, the location is None.

    The Description box is populated from the location selected. Enter the name in the Scope box if you want to filter the results to a particular scope. You need to type the exact scope name because there is no drop-down list.

    Figure 9-60

    Figure 9-60 Location Properties.

    The next list of check boxes appears only if Show Action Links is selected in the Miscellaneous section. By default, these options are used in the Search Action Links Web part but not in others. Figure 9-61 shows the results of all options selected in both Web parts. Two options, Display “Search From Windows” Link and Allow Users To Display Language Picker, seem to have no functionality in Beta code and might work only with FAST Search for SharePoint.

    Figure 9-61

    Figure 9-61 All action links enabled.

  • Display Properties. The first six configurations of this section, shown in Figure 9-62, are straightforward. The setting of 4 in the Results Per Page box is not the default; instead, it is a modification made to produce smaller pages for the screen shots in this Chapter.

    Figure 9-62

    Figure 9-62 Display Properties section.

    The Use Location Visualization check box must be cleared if you need to customize the Web part from the default settings defined in Federated Locations. It is the XML string contained in the Fetched Properties text box that defines much of the functionality of the Web part. These managed properties are sent to the Query Manager as managed properties to be retrieved for each search result in the result set.

    The code in the Core Results and Search Action Links Web parts follows:

    <Columns>
      <Column Name="WorkId" />
      <Column Name="Rank" />
      <Column Name="Title" />
      <Column Name="Author" />
      <Column Name="Size" />
      <Column Name="Path" />
      <Column Name="Description" />
      <Column Name="Write" />
      <Column Name="SiteName" />
      <Column Name="CollapsingStatus" />
      <Column Name="HitHighlightedSummary" />
      <Column Name="HitHighlightedProperties" />
      <Column Name="ContentClass" />
      <Column Name="IsDocument" />
      <Column Name="PictureThumbnailURL" />
      <Column Name="PopularSocialTags" />
      <Column Name="PictureWidth" />
      <Column Name="PictureHeight" />
      <Column Name="DatePictureTaken" />
      <Column Name="ServerRedirectedURL" />
    </Columns>

    The code for the People Core Results Web part code follows:

    <Columns>
      <Column Name="WorkId" />
      <Column Name="UserProfile_GUID" />
      <Column Name="AccountName" />
      <Column Name="PreferredName" HitHighLight="true" />
      <Column Name="YomiDisplayName" HitHighLight="true" />
      <Column Name="JobTitle" HitHighLight="true" />
      <Column Name="Department" HitHighLight="true" />
      <Column Name="WorkPhone" HitHighLight="true" />
      <Column Name="OfficeNumber" HitHighLight="true" />
      <Column Name="PictureURL" />
      <Column Name="HierarchyUrl" />
      <Column Name="WorkEmail" HitHighLight="true" />
      <Column Name="Path" />
      <Column Name="HitHighlightedSummary" />
      <Column Name="HitHighlightedProperties" />
      <Column Name="Responsibility" HitHighLight="true" />
      <Column Name="Skills" HitHighLight="true" />
      <Column Name="SipAddress" HitHighLight="true" />
      <Column Name="Schools" HitHighLight="true" />
      <Column Name="PastProjects" HitHighLight="true" />
      <Column Name="Interests" HitHighLight="true" />
      <Column Name="OrgNames" HitHighLight="true" />
      <Column Name="OrgUrls" />
      <Column Name="OrgParentNames" HitHighLight="true" />
      <Column Name="OrgParentUrls" />
      <Column Name="Memberships" HitHighLight="true" />
      <Column Name="AboutMe" HitHighLight="true" />
      <Column Name="BaseOfficeLocation" HitHighLight="true" />
      <Column Name="ServiceApplicationID" />
      <Column Name="SocialDistance" />
    </Columns>

    If you add managed properties to these lists, you must also modify the XSL to specify how the property is to be displayed. There are two options for modifying the style sheet for the Web part. In this section, you can click the XSL Editor button to expose the XSL code within the Web part. You will probably find it easier to copy the code into your favorite editor for modification and then paste the modified code back into the editor to save it. In the Miscellaneous section, you can enter the URL for an external style sheet used by one or more Web parts.

    Finally, the Parameters Editor permits the addition of parameters to the Web part.

  • Results Query Options. The Query Language picker shown in Figure 9-63 appears only if the Show Action Links is check box is not selected in the Miscellaneous section. The default setting, Browser Locale, probably should read “Default” because using the language of the browser locale configuration can be overwritten by a user preference in the search box.

    Figure 9-63

    Figure 9-63 Results Query Options section.

    The Cross-Web Part Query ID picker options are User Query, Query 2, Query 3, Query 4, and Query 5. As discussed earlier in Results Pages Functionality, this ID is used by results Web parts to identify the Query Manager that they share. Web parts with the User Query option selected share the query sent to the results page. Those with Query IDs 2 through 5 share a Fixed Keyword Query and can be placed on any page where they process the query when the page loads.

    Remove Duplicate Results causes “duplicate” results to be merged. “Duplicate” in this case does not mean exact matches, particularly in the case of large files, because the crawler indexes only the first 16 megabytes (MB) of a file. Sometimes, if the content is the same, even a variation in file name does not disqualify a file as a duplicate.

    You can select Enable Search Term Stemming to link word forms to their base form. For example, variations of “run” include “running,” “ran,” and “runs.” Stemmers are not available for all languages.

    When the Ignore Noise Words check box is selected, any words listed in the noise word file for the query language are eliminated from queries. In SharePoint 2010, noise words are indexed and can be used for searches if this option is not selected.

    The Fixed Keyword Query text box can specify that the query contain any search term, including filters such as managed properties and scopes. Do not enter anything in this box if using the User Query Cross-Web Part query ID as the entry will cause the Web part to reject the user query. Core Results Web parts become powerful tools to roll up and display information from across boundaries that restrict other Web parts. For example, a simple entry of “announcements:1” in the Fixed Keyword Query box would cause the Web part to display links to all announcements in the search application index that the user had permissions to see. When placing multiple results Web parts with Fixed Keyword Query entries, they must all use a unique Cross-Web Part query ID.

    The value entered in the Append Text To Query text box differs from a value entered in the Fixed Keyword Query box in that it adds the terms and filters to the query entered by the user. Unlike the Additional Query Terms setting of the Search Box Web part, this entry is transparent to the user because it is added on the results page, not passed to the results page as part of the query.

    The More Results List Options section (not shown) is irrelevant to Results Web parts on a results page because the page uses the Paging Web part to expose other results. However, if it’s used independently on a separate page, you might want to enter a link to a full results page to receive the query and present a full results list.

    The Appearance, Advanced, and AJAX Options sections are common to all Web parts and were discussed in Chapter 7. Remember that if you need to target a Web part to an audience, that configuration is found in the Advanced section.

  • Miscellaneous. Appropriately named, the Miscellaneous section, shown in Figure 9-64, contains some vital configurations for this Web part. First, the default 1000 count for the Highest Result Page setting is the count for pages, not items in the result list. Given the default 10 results per page, 10,000 items in a result list is probably more than any user will examine even with the new Refinement Web part filtering capability. Lowering this number when permissible will improve performance.

    Discovered definitions appear in the lower portion of the results Web part as “What people are saying about <term>”. These results are automatically extracted by the linguistic processing built into the indexing process. The process is seeking any phrase that infers a meaning. The smaller your index, the less likely you are to get a discovered definition.

    If you deselect the Show Search Results check box and configure the action links, you now have an Action Links Web part. The Search Actions Links Web part does not have this option.

    As discussed previously, selecting Show Action Links exposes the action links options in the Location Properties section and hides the Query Language picker in the Results Query Options section.

    The Show Messages setting enables the Web part to display error messages if an error occurs. This setting is useful when troubleshooting;otherwise, the Web part might not display at all when it has no results.

    The Sample Data setting is present only for testing the XSL presentation, but the XSL Link setting permits centralizing style sheets to control the presentation of multiple Web parts of the same type.

    Figure 9-64

    Figure 9-64 Miscellaneous

    Consider changing the Data View Caching Time-Out setting in a dynamic environment. Although a 24-hour cache improves performance on common queries, it might not present accurate results with frequent crawls.

    Search Web parts using the same Cross-Web part Query ID communicate with the Query Manager and not through connections. Although the Send First Row To Connected Web Parts When Page Loads option is selected, it is not required unless you have another Web part to connect to this one. Deselect this option to improve the performance of the Web part.

Federated Result

This Web part is similar to the Core Results Web part, so we will discuss only the differences. It is also used as people matches when using the Local People Search Federated location. First, it is not interacting with the Query Manager for local results but directly sending the query to another OpenSearch 1.1–compliant search engine. Any configurations relevant to manipulating local results are missing.

In Figure 9-60, all configurations in the Location Properties below Description are removed. In Figure 9-62, the Default Results Sorting setting is no longer controlled by the Web part because the results are received already sorted by the search engine. New options, shown in Figure 9-65, are added.

Selected by default, Retrieve Results Asynchronously permits the page to load without waiting for this Web part to receive and display its results. Show Loading Image is not selected by default but will display the animated gif specified in Loading Image URL while the Web part is waiting for a response from the remote search engine. If you want to change this image, place the replacement in the same location as the default.

Figure 9-65

Figure 9-65 Federated Result Web part Display Properties addition.

In Figure 9-63, the only options left in the Results Query Options list are Fixed Keyword Query and Append Text to Query, which operate the same as in the Core Results Web part. For the Miscellaneous section, shown in Figure 9-64, only the configuration options below Show Messages are available.

Top Federated Result

As shown in Figure 9-66, you can configure multiple federated locations for this Web part. However, it displays only the results from the first federated location to return search results. Otherwise, it is a Federated Results Web part.

Figure 9-66

Figure 9-66 Top Federated Results location properties.

Search Best Bets

The Best Bets Web part does interact with the Query Manager object, but most of the configurations are substantially different from the Core Results Web part, as shown in Figure 9-67.

Figure 9-67

Figure 9-67 Best Bets Web part.

The Results Display section has a configuration only for the query ID. This Web part has no configuration for a fixed query, but it will use the fixed query from a results Web part on the page that uses the same query ID even if it is hidden or has no results to display.

For Keywords, choose whether to display the keyword, keyword definitions, or both. For Best Bets, you can modify the display without changing the style sheet. Your options are Display Title, Display Description, Display URL, and Best Bets Limit. Displaying only the description does not give the user a hyperlink to access the Best Bet object.

This Web part was called the High Confidence Results Web part in previous versions of SharePoint Search. This section is configured to display an exact match in a people search. Much of this functionality has been replaced and enhanced by the Local People Search Federated Location, which is used by a Federation Results Web part.

Search Paging

For a search results page, this Web part extends the capabilities of a simple More Results link to a new page by providing a series of paging links before and after the current page of results within the Core Results Web part. Although the Results Web part controls the number of results in each page, the Paging Web part presents a common interface for scrolling through the results set. The properties, shown in Figure 9-68, are straightforward and easy to understand. Labels for the Previous and Next links are probably not necessary, and if you choose to change the images, be sure to place your images in the same location to avoid permissions issues. The only configuration that seems out of place is the Cross-Web part query ID, which is in the Miscellaneous section. This Web part must share the query ID of the Results Web part.

Figure 9-68

Figure 9-68 Search Paging properties.

Search Statistics

The Search Statistics Web part is also easy to understand and configure as shown in Figure 9-69. The display mode options are One Line or Two Lines. Selecting Display Total Number Of Results produces a disturbing “of about ## results.”

Figure 9-69

Figure 9-69 Search Statistics properties.

This number changes if the user re-sorts the results or scrolls through pages of results. Security trimming of the results list is performed on the results page. With the default potential results list being 10,000 items, the overhead of security trimming the entire list prior to displaying 10 items would be tremendous. So the trimming is done as the items are prepared to be displayed. Because the Statistics Web part total number of results will include items that might be trimmed due to security, the count cannot be accurate until all items are viewed.

If your server response time is really good, you can choose Display Search Response Time. Again, this Web part must share the query ID of the Results Web part.

Related Queries

This Web part displays user queries that contain the term that the current query contains. The more search is used, the more valuable this Query Suggestions tool becomes. The configuration options are very limited, as shown in Figure 9-70. Probably the only change that you might make will be the Results Per Page setting.

Figure 9-70

Figure 9-70 Related Queries properties.

Search Summary

The simplest Web part to configure is Search Summary, shown in Figure 9-71. Other than the standard Appearance, Layout, and Advanced sections, there is only a Show Messages check box and the Cross-Web Part query ID section. Deceptively named, this Web part is located just below the Search Query Web part and presents terms from the index that are similar to the query term passed to the results page. It is probably most useful for correcting misspelled query terms.

Figure 9-71

Figure 9-71 Search Summary properties.

Refinement Panel

Although the Related Queries Web part presents a tool to expand your query on the right side of the results page, the Refinement Panel on the left side presents dynamic options to refine or drill down into the search results without initiating a new query.

Configuration of this “faceted search” Web part has both simple and complex components. The simple, properties piece is shown in Figure 9-72. For the term Category, think Manage Property.

Figure 9-72

Figure 9-72 Refinement Panel properties.

This Web part must share the query ID with the core results Web part. If you prefer to use another name, type it in the Refinement Panel Caption box. We will address the Filter Category Definition setting later. The Accuracy Index setting determines how far down the results list the Web part will collect metadata to use in “faceting” its results. The Number Of Categories To Display setting is straightforward, and the Number Of Characters To Display setting refers to each line in the display. The character count is not exact as the ellipses at the end of an incomplete word counts as two characters.

Editing the Filter Category Definition setting is the more complex part. Before beginning to edit the XML string, clear the Use Default Configuration check box or the Web part will not save your changes.

Place your cursor in the Filter Category Definition text box to activate the Builder text editor blue button. Click the button to open the editor. It will be easier to copy the entire contents and use your favorite XML editor to make changes, and then paste the modified string back into the Builder text editor to save the changes.

The first portion of the code that specifies a category based on file extensions follows:

<?xml version="1.0" encoding="utf-8" ?>
<FilterCategories>
<Category Title="Result Type" Description="The file extension of the item"
Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGener
ator"MetadataThreshold="5" NumberOfFiltersToDisplay="4"
MaxNumberOfFilters="0"SortBy="Frequency" SortDirection="Descending"
SortByForMoreFilters="Name"SortDirectionForMoreFilters="Ascending"
ShowMoreLink="True"MappedProperty="FileExtension" MoreLinkText="show more"
LessLinkText="show fewer">
<CustomFilters MappingType="ValueMapping" DataType="String"
ValueReference="Absolute" ShowAllInMore="False">
   <CustomFilter CustomValue="Word">
  <OriginalValue>doc</OriginalValue>
  <OriginalValue>docm</OriginalValue>
  <OriginalValue>docx</OriginalValue>
  <OriginalValue>dot</OriginalValue>
  <OriginalValue>nws</OriginalValue>
  </CustomFilter>

If you have additional file types that are not included in the XML, you can add them by carefully following the structure given, where CustomValue is the display name of the application and the multiple entries of OriginalValue are all the possible file extensions for this application.

The following string identifies a specific managed property to be used as a facet for filtering search results. This construct can be used to add any custom managed property. Text managed properties must not be stored as a hash to be used in the Refinement Web part. The managed property must also have the Add Managed Property To Custom Results Set Retrieved On Each Query option selected.

<Category Title="Author" Description="Use this filter to restrict results
authored by a specific author"
Type="Microsoft.Office.Server.Search.WebControls.ManagedProperty
FilterGenerator"MetadataThreshold="5"NumberOfFiltersToDisplay="4"
MaxNumberOfFilters="20"SortBy="Frequency" SortByForMoreFilters="Name"
SortDirection="Descending"SortDirectionForMoreFilters="Ascending"
ShowMoreLink="True"MappedProperty="Author" MoreLinkText="show more"
LessLinkText="show fewer" />

Following the examples in the default XML string, even nonprogrammers can easily modify the metadata used to refine the search results if it exists for the objects in the results list.

Use the XSL Editor to customize the style sheet where needed.