In some cases, you may want to output the values of a property for some repository items of a certain type but not for others of that type. For example, you may want to output the value of the longDescription
property of most product
items, but omit this property for a few specific product
items.
The Oracle Commerce Platform includes an interface, atg.repository.search.indexing.IndexingPropertyFilter
, for filtering properties of specific repository items. This interface defines a single method:
filterOutputProperties(RepositoryItem pItem,
OutputProperty[] pOutputProperties)
This method is used to implement the logic that determines which property values to exclude from output records.
The Oracle Commerce Platform also includes a class that implements this interface, atg.repository.search.indexing.filter.GSAPropertyFilter
. This class has two properties that are used to specify the property values to exclude:
idToType
A Map in which the keys are IDs of repository items and the values are their item types.
propsToFilter
A List of the properties of the items specified byidToType
whose values should be excluded from the output. Note that the property names you supply should be the output names used in records, after any prefix or suffix replacement or property renaming.
Commerce Reference Store includes a component of this class, /atg/commerce/endeca/index/GSAPropertyFilter
, that is configured as follows:
idToType=rootCategory=category,\
homeStoreRootCategory=category
propsToFilter=allAncestors.displayName
To apply a GSAPropertyFilter
component to an item type, you use the filter
attribute of the item
element in the EndecaIndexingOutputConfig
definition file. For example, Commerce Reference Store adds this attribute to the ancestorCategories
item specification in the definition file of the ProductCatalogOutputConfig
component:
<item is-multi="true" property-name="ancestorCategories"
filter="/atg/commerce/endeca/index/GSAPropertyFilter">
The filterOutputProperties()
method of the GSAPropertyFilter
class examines the idToType
property to see which repository items to filter. In Commerce Reference Store, the property is configured so that filtering is done for the category
items whose IDs are rootCategory
and homeStoreRootCategory
. It then uses the value of the component’s propsToFilter
property to determine which properties to exclude the values of. propsToFilter
is set to allAncestors.displayName
, so the value of this property is not output for the rootCategory
and homeStoreRootCategory
categories. (This is done to address a problem in Commerce Reference Store where searching for “root” would return every product in the catalog repository, because that word appears in the value of the displayName
property of both items, and every product has one of these categories as an ancestor category.)
You can create other components of class GSAPropertyFilter
and configure the idToType
and propsToFilter
properties to filter different item types and properties, or you can implement different filtering logic by writing your own class that implements the IndexingPropertyFilter
interface.