If you are using Oracle ATG Web Commerce multisite, many of the item types in the catalog repository have a siteIds
property whose value is a comma-separated list of the sites an item appears on. For example, if you have three sites, A, B, and C, and a certain product is available on sites A and C (but not B), the value of the product’s siteIds
property would be siteA,siteC
(assuming those are the site IDs).
The siteIds
properties in the catalog repository are defined as context membership properties. For the document-level item type, the XHTML output includes a special $siteId
metadata property representing the repository item’s context membership property. (The metadata property in the XHTML is always named $siteId
, regardless of the actual name of the context membership property.) The output includes a separate tag for each site listed in the context membership property. For example:
<meta name="atg:string,index:$siteId" content="siteA"/>
<meta name="atg:string,index:$siteId" content="siteC"/>
Note that the XHTML output documents include tags only for sites that correspond to the content set selected in Search Administration. For example, if the value of a product’s siteIds
property is siteA,siteC,siteD
, but the content set being indexed is associated only with sites C and D, the XHTML document will not include a tag for site A. If an item’s siteIds
property is null, or if it lists only sites that are not associated with the selected content set, no XHTML document is generated for the item.
Creating a Separate Document for Each Site
If you want to create a separate document for each site, you can do so by using the /atg/search/repository/UniqueSiteVariantProducer
component. This component is of class atg.commerce.search.producer.UniqueSiteVariantProducer
, which implements the atg.repository.search.indexing.VariantProducer
interface.
UniqueSiteVariantProducer
creates a separate document for each site that meets both of these criteria:
The ID of the site is included in the
siteIds
property of the item being indexed.The site corresponds to the content set selected in Search Administration.
For example, if you are indexing by product and the value of a product’s siteIds
property is siteE,siteF,siteG
, and the content set being indexed is associated with sites B, E, and F, UniqueSiteVariantProducer
creates two XHTML documents, one for site E and one for site F. The documents are virtually identical, except that each one has a different value for the $siteId
property. A search that returns the product may return multiple instances, depending on the query constraints and grouping options used.
To use the UniqueSiteVariantProducer
, add it to the ProductCatalogOutputConfig
component’s variantProducers
property:
variantProducers+=\
/atg/search/repository/UniqueSiteVariantProducer
Note that this variant producer does not require a corresponding property accessor.