Ektron Reference


>>Helping Users Navigate Your Web Site > Using Search > Architecture of Search Server Controls

Understanding Search Server Controls

Beginning with Ektron version 8.5, the capability of Search is enhanced with several new server controls. The server controls provide four major areas to organize your search.

Controls Enables the searching of For more information, see
Site Search server controls Content, documents, file created or imported to the Workarea Deploying Site Search Server Controls
XMLSearchView server controls XML content created with Smart Forms XMLSearch Server Controls
User Search Server Controls CMS users, members, and membership groups Deploying User Search Server Controls
Product Search Server Controls An eCommerce site for products in the eCommerce system Deploying Product Search Server Controls

NOTE: To apply paging to a search results page, use an EktronUI:Pager.

This section also contains these topics.

Architecture of Templated Server Controls

Templated server controls are more specialized than their predecessors, which typically used one control to retrieve and display results. To provide search functionality, use three templated controls.

An example of this relationship using site search controls is illustrated below.

Benefits of these controls include the ability to:

To replicate all of the previous search server controls' functionality, use a combination of templated controls. For example, use the Pager control to manage the paging of search results. Also, use the Advanced QueryText parameter to limit results to those in a selected folder, in a selected taxonomy category, etc.

Search server controls have no Ektron-specific properties. In contrast, the pre-8.5 Search server control properties let you configure language, Display XSLT, folder ID, etc.

References

Modifying Templated Server Controls

You modify the behavior of templated controls by editing their markup. You no longer use Ektron server control properties nor an XSLT to edit the control's behavior.

You can edit a control's default markup, as well as the markup on any page that contains it.

See Also: Modifying the Text Displayed by Templated Server Controls

Modifying the Default Markup

InputView and ResultsView controls have a corresponding .ascx template that contains their default markup. To change a control's default markup, modify its template.

To find a control's template file, open the folder site root\workarea\FrameworkUI\Templates\Search, and locate the .ascx file that matches the control's name. For example, siteroot\workarea\FrameworkUI\Templates\Search\SiteSearchResultsView.ascx.

NOTE: "Controller"controls only process data. Since they have no UI component, they do not have a template file.

The default .ascx file affects all instances of a control on your Web site. However, you may customize single instances of a control. To do so, see Modifying Markup for a Single Instance of a Control.

Modifying Markup for a Single Instance of a Control

To customize a single instance of a templated search server control, follow these steps.

  1. Open a page in Visual Studio.
  2. Drag an InputView or a ResultsView control onto the page. This section uses the SiteSearchResultsView control as an example.
  3. Insert <ItemTemplate> tags between the control's opening and closing tags. <ItemTemplate> tags instruct the server control to ignore the default properties.
  1. Copy the default markup from the control's corresponding .ascx file. Here is a portion of that. See Also: Understanding Search Server Controls
  1. Modify the markup to your specifications. See Also: Modifying a Templated Control's Markup

Modifying a Templated Control's Markup

Within an </ItemTemplate> tag, use an eval statement (<%# Eval() >) to access Ektron's Search API object and expose its properties to the data binder. For example, <%# Eval (“QueryText”)%> displays the search term in the search results.

As an example, you can remove the summary from the search results by deleting this line.

                <div class="summary"><%# Eval("Summary") %></div>
            

Data Fields Available to an Eval Statement

Use an <%# Eval()> statement to determine which field properties appear in search results. For example, <%# Eval("Summary")%> displays each content item's summary.

When you insert <%# Eval()> between a set of </ItemTemplate> tags, a model is passed to the statement. Each set of controls has a model that determines available fields and properties. For example, the SearchModel's Results property includes these fields:

Documentation for Data Fields and Properties

The following topics list each model's fields and properties.

Discovering a Model's Fields Using the Object Browser

Follow these steps to discover a model's fields and properties using the Object Browser.

  1. Open your Ektron Web site within Visual Studio.
  2. Open the Object Browser.
  3. In the Browse field, enter the set of controls whose model you want to view. For example, ProductSearchModel.

Other models are SearchModel (covers content and XML Smart Forms) and UserSearchModel.

  1. The model's fields appear in the right pane.
  1. To view any field's properties, enter its name into the object browser. Omit the angle brackets (<>).

Modifying the Text Displayed by Templated Server Controls

To modify the text displayed by a templated control (for example, no results found), edit the corresponding .resx file in the site root\workarea\FrameworkUI\Templates\Search\app_loclaresources folder.

For example, to edit text supplied by the Site Search template, edit site root\workarea\FrameworkUI\Templates\Search\app_loclaresources\SiteSearchInputView.ascx.resx.


Ektron Version 8.5, Doc. Rev. 2.0 (Dec. 2011)
Visit the
Ektron Dev Center at http://dev.ektron.com 1–866–4–EKTRON
Ektron Documentation, © 2011 Ektron, Inc.