4. Customizing the Results Presentation
SharePoint 2010 provides the flexibility to control
result page features such as document preview, sorting, and spell check.
If a FAST Search capability is added to a mobile phone application, one
or more features of the FAST functionality should be removed to ensure
quick page download times. When a FAST Search site is created by
default, the Results.aspx page has several different content areas that
you can modify. Figure 13 shows the search results page and some of the major Web Parts.
The following sections describe each Web Part on the Results.aspx page and its function.
4.1. Refinement Panel
Previous versions of SharePoint did not support faceted search
results. Faceted search results, also called refiners, provide users
with alternative methods of exploring result data through the use of
filtering. Using filters with different classifications across result
sets of varying sizes while retaining counts of the documents found for
each query provides users with detailed information, such as which
documents are Microsoft Word documents in the result set or how many
documents are written by a specific author. Faceted search results are
located in the refinement panel.
When a user executes a search query, the refinement
panel provides the user with relevant search categories (or metadata)
for the first 50 items in the results list. These results are based on
predefined search criteria. For example, if a user clicks the Microsoft
Word hyperlink, all matching Word documents are shown in the search
results. Several categories of refinement queries are provided by
default: site-specific information, similar authors, company, and
product category. All links under the Result Type heading allow the user
to filter the result set to include only Microsoft Word documents, as
an example. By default, SharePoint Server includes Result Type queries,
as shown in Figure 14.
Note:
Both SharePoint Search and SharePoint FAST Search
include the refinement panel. However, the SharePoint Search refinement
panel only reflects a count using the documents shown in the result set
that has been security trimmed. To conserve resources, SharePoint Search
security trims the results list as it is prepared for a view to be
presented to the user. As a result, the count may change depending on
sorting or filtering options. A user must view all items to get accurate
counts. FAST for SharePoint Server security trims items as they are
added to the results list and therefore provides accurate result counts.
You can apply refiners to a results page using the
individual Web Parts on the search results page. You can also customize
additional configurations through development tools, but the standard
Web Parts and XML give you a great deal of capability without requiring
code. You can customize the refinement
panel to reflect relevant data for the user. For an intranet site, you
might want to use the full capabilities of the refinement panel;
however, for an Internet-facing site, you might find that a limited
subset is a better choice. In earlier versions, changing or creating
result sets required a developer with knowledge of the SharePoint Server
2007 search engine. In SharePoint 2010, customizing search Web Parts can be done by a farm administrator.
To fully understand the options available in the
refinement panel, open the search results page for edit and modify the
Web Part. The Web Part properties look similar to those shown in Figure 15.
Note:
Each section in the property page contains distinct
options available and you should change the options thoughtfully and
with caution. This section doesn’t cover all the options available in
the search Web Parts. Be sure to test any changes in a development
environment before changing them on a production server.
When the FAST Search site is created, the relevant
data Web Part shows different sections that pertain to different filters
that are available based on available metadata definitions. One such
section is the Modified Date section, which a farm administrator could
use, for example, to add a column that shows the past three months of
data in addition to the defaults. SharePoint 2010 makes adding columns
like this straightforward and editable with just a few steps.
To add a new relevant search query, open the Refinement section in the Refinement Panel as shown in Figure 16 and follow these steps.
By default, the Use Default Configuration check box is selected. Clear the check box to ensure that customizations are saved.
Place
your pointer in the Filter Category Definition text box to activate the
Builder text editor blue button at the end of the text box. Click the
button to open the editor. Copy and save the text in a text file. This
text usually displays as one long line, so it is helpful to have line
wrapping turned on in your text editor.
Note:
It is best to open this file in Notepad; opening it in Microsoft Write or Microsoft Word could cause formatting issues.
The file is in XML format, and to add an entry to reflect the type of search condition being created, look for the following text.
<CustomFilter CustomValue="Past Month">
<OriginalValue>-30..</OriginalValue> </CustomFilter>
Type the following text just after the text shown in step 3.
<CustomFilter CustomValue="Past Three Months">
<OriginalValue>-90..</OriginalValue> </CustomFilter>
Look for the following line of text a few rows above the text you just added.
NumberOfFiltersToDisplay="6"
Add one to the number to reflect the new line you added into the XML.
NumberOfFiltersToDisplay="7"
Copy the code from the text file back into the Builder text editor from the Web Part. Figure 17 shows what the result might look like.
Click OK, save the page, and check it in and publish it if required by the page library. Figure 18 shows the newly created Past Three Months relevant search.
Alternatively, you also can add new relevant search
categories. These search categories are tied to managed properties, so
be sure to create the managed property first and run a full index before
adding them using the previous procedure.
You can also find options under the refinement
tab such as accuracy index, categories to display, and number of
characters to display. The accuracy index allows the administrator to
determine the number of results used to display the different relevancy
searches. This is important if requirements exist that only show the top
five or ten links and related search information on a mobile phone.
4.2. Search Core Results
Both SharePoint Search and SharePoint FAST Search use
federated search Web Parts to display search results. Federated search
Web Parts provide a method for retrieving search results from any
OpenSearch 1.1 compliant search engine including SharePoint farms, an
enterprise application, or other API accessible applications. Each
product provides a unique Search Core Results Web Part and much of the
customization for the search results is done in the properties of this
Web Part. The figures show the properties from each product when
necessary to reflect the different features. Figure 13-36
shows all the property sections available, but not all sections will be
covered in this discussion. The following configuration items are
necessary to achieve quality results for users.
Location The Location Properties section is expanded in Figure 19
and contains two crucial configurations. The Location drop-down list
presents the Federated Locations defined at the search application
level. SharePoint Search 2010 uses the Local Search Results as shown in Figure 13-36.
FAST search uses the Local FAST Search Results. The Scope box provides
the option to limit search results to one or more search scopes, which
may be defined at the search application or local site collection level
as defined by the search scope. You must type the exact scope name in
the box because no drop-down list of possibilities is provided. The
scope configuration option is normally used on custom search results
pages or when using the Search Core Results Web Part to display fixed
queries.
Display Properties section The FAST Search Web Part properties shown in Figure 20
include several configuration options in the Display section that are
not available in SharePoint Search. There are check boxes to enable
Similar Results, Document Preview for Microsoft PowerPoint, and
Thumbnail Preview for Microsoft Word documents. The Maximum Number Of
Document Previews And Thumbnails option controls the results displayed
to users, whereas the Maximum Number Of Concurrent Requests For Document
Previews And Thumbnails will impact the resources consumed by the
display. The SharePoint Search 2010 Web Part (not shown) only has one
configuration: Default Results Sorting, which has options for Relevance
and Modified Date. Relevance is the default configuration. The rest of
the configurations shown in Figure 20 are common to both Web Parts.
Results Query Options section The FAST Search Web Part properties shown in Figure 21
present configuration options for the Spellchecking feature, which is
not available with SharePoint Search 2010. Enable Spellchecking options
are Off, Suggest, and Rewrite. By default, spell checking is set to
suggest the proper spelling for search terms. If the option is set to
Rewrite, then the options are available for actions to perform if no
results are returned.
The
remainder of the Results Query Options section is common to both search
products. The default Query Language setting, Browser Locale, uses the
language of the browser locale configuration unless overwritten by a
user preference in the search box. Any language recognized by the search
product may be selected from the drop-down list for this configuration.
The Cross-Web Part Query ID options
are User Query, Query 2, Query 3, Query 4, and Query 5. 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.
Selecting
the Remove Duplicate Results check box causes “duplicate” results to be
merged. “Duplicate” in this case does not mean exact matches, because
the SharePoint crawl component only indexes the first 16 megabytes (MB)
of a file. If the content is the same in that first part of the file,
even a variation in the file name does not disqualify a file from being
considered 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.
If Ignore Noise
Words is enabled, any words listed in the noise word file for the query
language are removed 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.
When placing multiple results Web Parts with Fixed Keyword Query
entries, they must all use a unique Cross-Web Part query ID.
Note:
Core Results Web Parts become powerful tools to roll
up and display information across site collection boundaries. 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 for which the user has access.
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. This entry is transparent to the user as it
is added on the results page and does not appear as part of the query.
More Results List Options section
This section is only useful if the Web Part is used to present fixed
query results on a separate page, because the results page uses the
Paging Web Part to expose the complete results. This option configures a
link to a full results page to receive the query and present a full
results list.
Appearance, Advanced, and AJAX Options sections
These sections are common to all Web Parts. If you need to target a
Search Core Results Web Part to an audience, that option is in the
Advanced section.
Miscellaneous Options section Shown in Figure 22,
this section contains some significant 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 Search Core 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 clear the Show
Search Results check box and configure the action links, you now have an
Action Links Web Part. Enabling Show Action Links adds the action links
options in the Location Properties section and removes the Query
Language picker in the Results Query Options section.
When
Show Messages is enabled, the Web Part displays error messages if an
error occurs. This setting is useful when troubleshooting; otherwise,
the Web Part does display 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.
Note:
MORE INFO To find out more about other search Web Parts, see Microsoft SharePoint 2010 Administrator’s Pocket Consultant by Ben Curry (Microsoft Press, 2010), which will walk you through configuring search Web Parts step by step.