The document loaders access property values through an implementation of the interface. This interface defines methods for getting property values from repository items. It defines separate methods for text properties and meta properties, as well as for properties that return child items. By default, the loaders use the class, which simply invokes the RepositoryItem.getPropertyValue method. You can write your own implementations of PropertyAccessor that use custom logic for determining the values of specific properties. The simplest way to do this is to subclass PropertyAccessorImpl.

In the definition file, you can specify a custom property accessor 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.

loading table of contents...