In some cases, it is useful to filter a set of property values before outputting an XHTML document. For example, suppose your document-level item has many child items, and each child item has a color
property that can have only a few possible values. Rather than outputting the color of every child item, you could include each color in the document just once, by using a filter that removes duplicate property values.
The PropertyValuesFilter
interface defines a method for filtering property values. The atg.repository.search.indexing.filter
package includes several implementations of this interface:
UniqueFilter
removes duplicate property values, returning only the unique values.ConcatFilter
concatenates all of the property values into a single string.UniqueWordFilter
concatenates all of the property values into a single string, and then removes all duplicate words.HtmlFilter
removes any HTML markup from the property values.
This section provides information about what these filters do and when they’re appropriate.
In the definition file, you can specify property filters by using the filter
attribute. Note that you can use multiple filters on the same property. The value of the filter
attribute is a comma-separated list of Nucleus components. The component names must be absolute pathnames.
To simplify coding of the definition file, you can map PropertyValuesFilter
Nucleus components to simple names, and use those names as the values of filter
attributes. You can perform this mapping by setting the filterMap
property of the IndexingOutputConfig
component. This property is a Map in which the keys are the names and the values are PropertyFilter
Nucleus components that the names represent.
Note, however, that you do not need to perform this mapping to use the UniqueFilter
, ConcatFilter
, UniqueWordFilter
, or HtmlFilter
class. These classes are mapped by default to the following names:
Filter Class | Name |
---|---|
|
|
|
|
|
|
|
|
So, for example, you can specify UniqueFilter
like this:
<property name="color" filter="unique"/>