Calculated features for asset relations

Introduction

censhare provides for assets to be filtered for asset features in the filter component of the asset query window. Asset reference features are features that reference a different asset. They are used in the standard article structure for rubrics, topics, target groups. Asset relations and references can be used with the filter panel in the asset query window. Just add the key to the feature. If you want to filter for asset relations, then create a calculated feature.

Users can filter for asset reference features (e.g. keywords as assets, input forms as assets, ) and asset relations (author relations to person assets, manufacturer relation to company asset, ). The filter displays the names of these assets.

Asset references are stored in asset reference features. The asset id of the references feature is the value of this asset feature. Asset relations are not stored as asset features. Therefore it is necessary to create a calculated asset reference feature, where the asset IDs of the related assets are stored as values.

Alternate results

Feature widgets based on asset references were previously implemented in a way, that they did not ask for alternate results. The asset queries looked like this:

<condition altresults=false name="censhare:manufacturer-asset" refid="26"/>
    If they have alternate results, the results looks like:
    <altresults corpus:value_type="ASSET" count="2" refid="26">
    <altresult corpus:count="2" corpus:is_empty="true"/>
    <altresult corpus:count="2" corpus:label="217751" corpus:value="217751"/>
    </altresults>
XML

Display items for filters

In the filter window component:

In order to display the name of the assets from the alternate results, it is necessary to read the asset XML of the referenced asset. This happens at the server. Then the alternate should look like this:

<altresults corpus:value_type="ASSET" count="2" refid="26">
    <altresult corpus:count="2" corpus:is_empty="true"/>
    <altresult corpus:count="2" corpus:label=Name of the asset corpus:value="217751"/>
    altresults>
XML


It is necessary to display the localized asset name. Therefore, if an asset name feature with the language of the logged-in user is available, then this name should be used, otherwise the name of the asset. Users can search with feature widgets for features based on asset references. The feature widget has been enhanced to read the alternate results and display them in a pop-up menu.


Too many calculated features may slow down your CDB rebuild.