By default, for the repository item type designated by the is-document attribute, the IndexingOutputConfig component generates one XHTML document per item. In some cases, though, you may want to generate more than one document for each repository item. For example, suppose you have a repository whose text properties are stored in both French and English, and the language displayed is determined by the user’s locale setting. In this case you will typically want to create two documents from each repository item, one with the text content in French, and the other one in English.

To handle situations like this, the ATG platform provides an interface named atg.repository.search.indexing.VariantProducer. You can write your own implementations of the VariantProducer interface, or you can use implementations included with the ATG platform. This interface defines a single method, prepareNextVariant(), for determining the number and type of variants to produce. Depending on how your repository is organized, implementations of this method can use a variety of approaches for determining how to generate variant documents.

The ATG platform includes an implementation of the VariantProducer interface, atg.repository.search.indexing.producer.LocaleVariantProducer, for generating variant documents for different locales. This class has a locales property where you specify the list of locales to generate variants for. For example:

locales=en_US,fr_FR

You specify the VariantProducer components to use by setting the variantProducers property of the IndexingOutputConfig component. Note that this property is an array; you can specify any number of VariantProducer components, and the IndexingOutputConfig will generate a separate variant for each possible combination of values of the variant criteria. For example, suppose you use LocaleVariantProducer and the locales property is set as shown above. If you add a second VariantProducer that creates three variants (1, 2, and 3), the total number of variants generated for each repository item would be six (French 1, English 1, French 2, English 2, French 3, and English 3).

 
loading table of contents...