Content Selection Framework Concepts
To optimize your use of Commerce Server 2002, it is important that you understand the underlying concepts on which the Content Selection Framework (CSF) is built.
Scoring
Filtering
Tracing and Debugging
Selecting
Formatting
Recording Events
Scoring
The CSF content selection process is a process of scoring content items and then selecting the "winners" based on those scores. The score for each content item is managed by the ContentList object and is a floating-point number. A content item score of zero means that the content item should not be selected under any circumstances.
There are two stages in a CSF pipeline that manipulate the scores of content items — one to assign an initial score to each item, and one to adjust the score based on targeting criteria. If there is no component in the initial scoring stage, then all content items receive an initial score of 1.0. Score adjustments made in the scoring stage should apply multipliers. A multiplier less than 1.0 can be used to reduce the score of a content item, a multiplier greater than 1.0 can be used to increase the score of a content item, and a multiplier of 0.0 can be used to eliminate a content item from further consideration.
Filtering
Filtering is the process of eliminating content items by using indexes built on the content in the ContentListFactory object. Because a filter uses pre-built indexes, it is considerably more efficient than expression evaluation, but at the expense of reduced flexibility. In the Commerce Server Advertising and Discount pipelines, filters are used on the Page Group and Content Size dimensions, but can be extended to filter on any string, integer, or array column in the ContentList object schema. A filter can require that content items have a particular column value, or it can exclude content items where the column contains particular values. Filters can also use sets of values, so that content items with any one of the values in the set will meet the filter requirements and will be passed through.
Tracing and Debugging
Sometimes it is difficult to know why a particular content item was selected and others were not. To debug or fine-tune a content delivery application, you can enable tracing in the pipeline. You enable tracing by setting the Trace property on the ContentSelector object to true. When tracing is enabled, all modifications to content item scores are tracked. Components that perform scoring should check to see if tracing is enabled, and if it is, then they should pass descriptive strings when calling the SetScore or AdjustScore methods on the ContentList object. The Commerce Server 2002 Software Development Kit (SDK) contains a file called TraceScores.asp that can be used to display the trace strings for each content item, as well as each item's final score. Tracing should be used only for debugging; it should not be used in production. When the Trace flag is on, it severely degrades the performance of the CSF pipelines.
The OrderPipeline object itself provides a rudimentary form of logging so that you can see what values are read and written to or from the Order and Context dictionaries that are passed through the pipeline. To enable this type of debug logging, call the SetLogFile method on the pipeline.
Selecting
After score adjustments have been made, the CSF pipeline has to select the "winners." The SelectWinners component provided with Commerce Server treats advertisements differently than generic content items. For generic content items, it simply picks the item(s) with the highest score. For advertisements, it first decides whether to show a house ad or a paid ad. If a paid ad is selected, it takes the ad with the highest score. If a house ad is selected, it uses the weights of all house ads as probabilities and selects from among them randomly. The SelectWinners component also prevents competing ads from running on the same page and can use a PageHistory string to prevent selecting the same content item multiple times on the same page.
Formatting
The winning content item(s) need to be formatted as strings before they are returned to the page. Formatting brings the properties of the content item and the global- and page-level context properties together and uses them as insertion strings into a provided template. The end result of formatting is a SimpleList object of string values, with each list entry containing the string representing a content item. For information about the formatting process, see FormatTemplate.
Recording Events
Whenever an ad is served or clicked, this event has to be recorded. The Need of Delivery (NOD) algorithm for advertisements uses this event information to compute the score of an ad. The RecordEvent component records these events into an in-memory Dictionary object, called the Performance Dictionary. At the time of the next cache refresh, these events are written to the database by the CSFWriteEvents component. The IISAppendToLog component also records these events to the Internet Information Services (IIS) 5.0 log file for later importing into the Commerce Server Data Warehouse.
Copyright © 2005 Microsoft Corporation.
All rights reserved.