In addition to the PropertyAccessor and VariantProducer interfaces, the atg.repository.search.indexing package includes two other interfaces that you can use to customize your output:

Note that classes that implement these interfaces are applied after all of the output properties have been gathered, so these classes do not have access to the Context object.

The PropertyFormatter and PropertyValuesFilter interfaces and implementation classes are described below. For additional information, see the ATG API Reference.

PropertyFormatter

If a property takes an object as its value, the document loader must convert that object to a String to include it in an output document. The PropertyFormatter interface defines two methods for performing this conversion: formatText() (for text properties) and formatMeta() (for meta properties).

By default, the document loaders use the implementation class atg.repository.search.indexing.formatter.PropertyFormatterImpl. For text properties, this class simply invokes the object’s toString() method. For meta properties, it invokes getLong() for numbers, getTime() for dates, and toString() for other objects.

You can write your own implementations of PropertyFormatter that use custom logic for performing the conversion. The simplest way to do this is to subclass PropertyFormatterImpl.

In the definition file, you can specify a custom property formatter by using the formatter attribute. For example, suppose you have a Nucleus component named /MyStuff/MyPropertyFormatter, of a custom class that implements the PropertyFormatter interface. You can specify it in the definition file like this:

<property name="price" formatter="/MyStuff/MyPropertyFormatter"/>

The value of the formatter attribute is the absolute path of the Nucleus component. To simplify coding of the definition file, you can map PropertyFormatter Nucleus components to simple names, and use those names as the values of formatter attributes. For example, if you map the /MyStuff/MyPropertyFormatter component to the name myFormatter, the above tag becomes:

<property name="price" formatter="myFormatter"/>

You can perform this mapping by setting the formatterMap property of the IndexingOutputConfig component. This property is a Map in which the keys are the names and the values are PropertyFormatter Nucleus components that the names represent.

PropertyValuesFilter

In some cases, you may want 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 may want the document to include each color just once. To do this, you could use 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 two implementations of this interface:

In the definition file, you can specify property filters by using the filter attribute. Note that you can use multiple property 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.

For example, suppose you create Nucleus components of the UniqueFilter and ConcatFilter classes, and you map these components to the names myUnique and myConcat. You could then specify these filters like this:

<property name="color" filter="myUnique,MyConcat"/>
 
loading table of contents...