The definition file format begins with a top-level item element that specifies the repository and item descriptor to use, and then lists the properties of that item type to include. The properties appear as property elements within text-properties (used for full-text indexing) or meta-properties (used for constraints) elements. The top-level item element can contain child item elements for properties that refer to other repository items (or arrays, Collections, or Maps of repository items). Those child item elements in turn can contain property and item elements themselves.

For example, the following definition file enables indexing of site users and their home addresses:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE item PUBLIC "-//Art Technology Group, Inc.//DTD Repository Ouput
  Specifier 1.0//EN" "http://www.atg.com/dtds/search/indexing-dependency-
  schema.dtd">

<item item-descriptor-name="user"
  repository-path="/atg/userprofiling/ProfileAdapterRepository"
  is-document="true">
    <title property-name="lastName"/>
    <meta-properties>
       <property name="dateOfBirth" type="date"/>
    </meta-properties>
    <text-properties>
      <property name="firstName"/>
      <property name="lastName"/>
    </text-properties>
    <item property-name="homeAddress">
      <text-properties>
        <property name="address1"/>
        <property name="address2"/>
        <property name="city"/>
        <property name="state"/>
        <property name="postalCode"/>
        <property name="phoneNumber"/>
      </text-properties>
    </item>
</item>

Note that in the above example, the top-level item element has the is-document attribute set to true. This attribute specifies that an XHTML document should be generated for each item of that type (in this case, each user item). If, instead, you want to generate a separate XHTML document per homeAddress item, you set is-document to true for the homeAddress item type and not for the user item type. In that case, the parent properties (firstName and lastName in the above example) are repeated in each XHTML document.

Property values that come from standard JavaBean properties of the RepositoryItem object (rather than dynamic bean properties) are specified using a dollar-sign ($) prefix; e.g., $repositoryId or $repository.repositoryName. These dollar-sign property specifiers are the only constructions in the definition file that support JavaBean dot notation.

Multi-value Properties

The item element has an is-multi attribute for specifying multi-value properties. If a property is an array, Collection, or Map, you should set this attribute to true. The output XHTML document will include all of the values of the property.

For example, in a Commerce product catalog, a product item will typically have a multi-valued childSKUs property whose values are the various SKUs for the product. You might specify the property like this:

<item property-name="childSKUs" is-multi="true">
  <text-properties>
    <property name="displayName"/>
    <property name="description"/>
  </text-properties>
</item>

The output document will include the displayName and description value for each SKU.

For properties that are Maps, the situation is more complex, because each Map entry has a key and a value. To specify how to output the Map entries, you use the map-iteration-type attribute. The value of this attribute can either be entries or values.

If map-iteration-type=values”, only the values of the Map entries are output. Essentially, the values are treated as an array or Collection, and the keys are ignored. The values must be repository items, and the text-properties element is used to specify the properties of those items to output. For example:

<item property-name="someMap" is-multi="true" map-iteration-type="values">
  <text-properties>
    <property name="name"/>
    <property name="age"/>
    <property name="height"/>
  </text-properties>
</item>

If map-iteration-type=entries”, both the keys and the values of the Map are output; each Map entry is treated as if it were a repository item with two properties, key and value. The values of value can be either repository items or simple values such as primitives or Strings. For simple values, you can specify the output like this:

<item property-name="someMap" is-multi="true" map-iteration-type="entries">
  <text-properties>
    <property name="key"/>
    <property name="value"/>
  </text-properties>
</item>

If the values of value are repository items, you treat the items as child items of the Map entry. For example:

<item property-name="someMap" is-multi="true" map-iteration-type="entries">
  <text-properties>
    <property name="key"/>
  </text-properties>
  <item property-name="value">
    <text-properties>
      <property name="color"/>
      <property name="size"/>
      <property name="weight"/>
    </text-properties>
  </item>
</item>

Note that you can use map-iteration-type=entries” to display just the keys or just the values, by omitting the other tag.

 
loading table of contents...