The document loaders access property values through an implementation of the atg.repository.search.indexing.PropertyAccessor
interface. This interface defines separate methods for obtaining text properties, meta properties, and properties of child items. By default, the loaders in most cases use the atg.repository.search.indexing.PropertyAccessorImpl
class, which invokes the RepositoryItem.getPropertyValue()
method. You can write your own implementations of PropertyAccessor
that use custom logic for determining the values of properties that you specify. The simplest way to do this is to subclass PropertyAccessorImpl
.
In the definition file, you can specify a custom property accessor for a property by using the property-accessor
attribute. For example, suppose you have a Nucleus component named /MyStuff/MyPropertyAccessor
, of a custom class that implements the PropertyAccessor
interface. You can specify it in the definition file like this:
<property name="price" property-accessor="/MyStuff/MyPropertyAccessor"/>
The value of the property-accessor
attribute is the absolute path of the Nucleus component. To simplify coding of the definition file, you can map PropertyAccessor
Nucleus components to simple names, and use those names as the values of property-accessor
attributes. For example, if you map the /MyStuff/MyPropertyAccessor
component to the name myAccessor
, the above tag becomes:
<property name="price" property-accessor="myAccessor"/>
You can perform this mapping by setting the propertyAccessorMap
property of the IndexingOutputConfig
component. This property is a Map in which the keys are the names and the values are PropertyAccessor
Nucleus components that the names represent. For example:
propertyAccessorMap+=\
myAccessor=/MyStuff/MyPropertyAccessor