InitCSFPipeline

Use this component at the beginning of a Content Selection pipeline (CSP) to initialize the values needed in the rest of the pipeline.

Although this component appears as InitCSFPipeline in the Pipeline Editor, its ProgID is Commerce.CSFInitPipeline.

Intended use: Content Selection pipeline, LoadContext stage.

Configuration Values

None.

Values Read

The InitCSFPipeline component reads the following values from the indicated dictionary.

Key Dictionary Description
ContextProfile Context A reference to the ContentSelector object (CSO). This object can be assigned arbitrary properties and can be used to pass additional information into the pipeline. Two entries are required. For more information, see the Remarks section.

The InitCSFPipeline component reads the following values from the ContextProfile key.

Key Description
CacheName The name of the cache. Used to retrieve the cache from the CacheManager object.
CacheManager A reference to the CacheManager object.
Trace Optional. A Boolean providing the Trace setting for the entire pipeline. Set in the ContentSelector object. Use tracing only when debugging a pipeline — tracing degrades pipeline performance.
Evaluator Optional. Reference to an expression evaluator that is copied to the Context dictionary if it is set.
PageGroup Optional. If present, this key causes the Cache.PageGroup property to be copied into the Context dictionary. This key is also used as a key in the FilterRequire dictionary. For more information, see the Remarks section.
Size Optional. If present, this key is created as a key in the FilterRequire dictionary. For more information, see the Remarks section.
NumRequested Optional. The NumRequested property of the ContentSelector object: the number of content items requested. This key is copied to the Context dictionary if it is set.
UserProfile Optional. This key is a reference to a user profile object. This key is copied to the Context dictionary if it is set.
FilterRequire Optional. This key is copied to the Context dictionary if it is set. For more information, see the Remarks section.
FilterExclude Optional. This key is copied the to Context dictionary if it is set. For more information, see the Remarks section.

Values Written

The InitCSFPipeline component writes the following values in the indicated dictionaries.

Key Dictionary Description
_content Order A reference to a newly created and initialized ContentList object.
Performance Order A reference to the Performance dictionary, retrieved from the content cache. This key is used by the AdvertisingNeedOfDelivery component later in a pipeline to select content items. See RecordEvent for information about this dictionary.
NumRequested Order An optional entry created only if the ContextProfile object has a NumRequested property set. This key indicates the number of content items being requested. The pipeline returns only one content item when this key is not present.
FilterRequire Order This key is copied from the ContextProfile.FilterRequire object if present. When present, this key causes the FilterContent component to invoke the Filter method of the ContentList object for each entry in the dictionary. The FilterAction parameter will be set to FILTER_REQUIRE for these invocations. The dictionary has keys that are the names of content fields to search and values that are the values to match.
FilterExclude Order This key is copied from the ContextProfile.FilterExclude object if present. When present, this key will cause the FilterContent component to invoke the Filter method of the ContentList object for each entry in the dictionary. The FilterAction parameter is set to FILTER_EXCLUDE for these invocations. The dictionary has keys that are the names of content fields to search and values that are the values to match.
_cache Context A reference to the Dictionary object containing the items retrieved from the cache.
Templates Context The templates property of the cache. A Dictionary object.
Trace Context The trace setting from the ContextProfile object, if any. This value is used as the value for the TraceMode property in the ContentList object, turning tracing either on or off.
Evaluator Context The Evaluator object from the ContextProfile object.
RedirectUrl Context The Uniform Resource Locator (URL) to which to redirect users.
TargetGroups Context The TargetGroups entry from the cache.
PageGroups Context The PageGroups entry from the cache.
PageHistory Context The PageHistory entry from the ContextProfile object, if any.
UserProfile Context A reference to the user profile copied from the ContentSelector object (CSO).

Remarks

The InitCSFPipeline component is responsible for setting up numerous values in the Order and Context dictionaries for use by subsequent components in a Content Selection pipeline. In addition, the component automatically generates some content filters and allows you to use FilterInclude, FilterExclude, and PageGroups dictionaries to customize filtering without writing new pipeline components.

In general, the values the InitCSFPipeline component sets up in the Order and Context dictionaries are derived from the ContextProfile entry in the Context dictionary, or from the Cache dictionary retrieved from the CacheManager object. The ContextProfile entry in the Order dictionary contains a reference to the ContentSelector object, which provides much of the information required by the pipeline.

Also, by moving the various values from the ContextProfile to the Order and Context dictionary objects, the pipeline components farther down the pipeline have much more efficient access to this data.

Perhaps the most important task performed by the InitCSFPipeline component is the creation and initialization of the ContentList object. It is within this object that content scoring is tracked during execution of the pipeline.

The InitCSFPipeline component creates the ContentList object by following these steps:

  1. Retrieve the name of the cache from ContextProfile.
  2. Retrieve the CacheManager object from ContextProfile.CacheManager property.
  3. Get the cache from the CacheManager object.
  4. Obtain the ContentListFactory object from the cache.
  5. Call the CreateNewContentList method of the ContentListFactory object and assign the new content list to the _content key in the Order dictionary.

The FilterRequire and FilterExclude dictionaries allow custom filters to be set up without writing new pipeline components. For ease of use, the InitCSFPipeline component automatically sets up some commonly used filters for page group, ad size, and (for Discount Content Selection pipelines) NoDisplay templates. If no FilterRequire or FilterExclude dictionary is explicitly passed and one of these filters is applicable, the filter dictionary will automatically be created. If the InitCSFPipeline component detects existing filters for these keys already in a filter dictionary, it will not modify the filter.

The InitCSFPipeline component creates a filter for PageGroup (unless one already exists). This filter contains the special PageGroup "All" (Run of Site), which allows any content marked to run on the whole site to pass, and it also contains the value of the PageGroup property set on the ContentSelector object making the GetContent call (if set).

This component breaks the rule of never writing data to the Context dictionary. Nevertheless, the convention should be observed as it is by the vast majority of pipeline components.

See Also

ContentList.Filter

Copyright © 2005 Microsoft Corporation.
All rights reserved.