About styles

A style controls the number of records a rule may promote; it also defines property templates, and tells the Web application how to display rule results.

You create a style in the Styles view of Endeca Developer Studio. A style serves three functions:

Controlling the number of promoted records

Styles can be used to affect the number of promoted records in two scenarios:
  • A rule produces less than the minimum number of records. For example, if the Best Buys rule produces only two records to promote and that rule is assigned a style that has Minimum Records set to three, the rule does not return any results.
  • A rule produces more than the maximum. For example, if the Best Buys rule produces 20 records, and the Maximum Records value for that rule's style is five, only the first five records are returned.

If a rule produces a set of records that fall between the minimum and maximum settings, the style has no affect on the rule's results.

Performance and the Maximum Records setting

The Maximum Records setting for a style prevents dynamic business rules from returning a large set of matching records, potentially overloading the network, memory, and page size limits for a query. For example, if Maximum Records is set to 1000, then 1000 records could potentially be returned with each query, causing significant performance degradation.

Ensuring consistent property usage with property templates

As discussed in Dynamic business rule constructs, rule properties are key/value pairs typically used to return supplementary information with promoted record pages. For example, a property key might be set to SpecialOffer and its value set to BannerAd.gif.

As Endeca Workbench users and Developer Studio users share a project with rule properties, it is easy for a key to be mis-typed. If this happens, then the supplementary information represented by a property does not get promoted correctly in a Web application. To address this, you can optionally create property templates for a style. Property templates ensure that property keys are used consistently when pipeline developers and Endeca Workbench users share project development tasks.

If you add a property template to a style in Developer Studio, that template is visible in Endeca Workbench in the form of a pre-defined property key with an empty value. Endeca Workbench users are allowed to add a value for the key when editing any rule that uses the template's associated style. Endeca Workbench users are not allowed to edit the key itself.

Furthermore, pipeline developers can restrict Endeca Workbench users to creating new properties based only on property templates, thereby minimizing potential mistakes or conflicts with property keys.

For example, a pipeline developer can add a property template called WeeklyBannerAd and then make the project available to Endeca Workbench users. Once the project is loaded in Endeca Workbench, a property template is available with a populated key called WeeklyBannerAd and an empty value. The Endeca Workbench user provides the property value. In this way, property templates reduce simple project-sharing mistakes such as creating a similar, but not identical property called weeklybannerad.

Note: Property templates are associated with styles in Developer Studio, not rules. Therefore, they are not available for use on the Properties tab of the Rule editor.

Indicating how to display promoted records

by creating application-level rendering code for the style. You create a style in Developer Studio. You create rendering code in your Web application. Creating a style describes how to create styles. Information about rendering code is described in Presenting rule results in a Web application.

A style has a name and an optional title. Either the name or title can be displayed in the Web application. When the MDEX Engine returns rule results to your application, the engine also passes the name and title values to your application. The name uniquely identifies the style. The title does not need to be unique, so it is often more flexible to display the title if you use the same title for many dimension value targets, for example, the title On Sale may be commonly used.

Note: Without application-level rendering code that uses the specific style or title values, the style and title are meaningless. Both require application-level rendering code in an application.