Based on the properties set on the QueryRequest and the DynamicTargetSpecifier, the DynamicTargetGenerator may determine that the query should return results only from certain sites. If so, it can generate a constraint and set the value of the MultisiteConstraint component’s siteConstraints property to the generated constraint. Note that DynamicTargetGenerator generates a site constraint only if necessary; in some cases, sites may already be excluded based on the content sets being searched, so they don’t need to be excluded through a constraint.

MultisiteConstraint has a siteConstraintsOperation property for specifying whether the sites in the generated constraint should be combined using AND or OR Boolean operators. The default value of this property is or, so sites are combined using Boolean OR. This means that results will be returned from any site listed in the constraint. For example, this constraint means “return results that are associated with site A or site C”:

<or>
  <strprop name="$siteId">A</strprop>
  <strprop name="$siteId">C</strprop>
</or>

If you set siteConstraintsOperation to and, the query returns only results that are associated with both site A and site C.

In addition to the generated site constraint, MultisiteConstraint has an additionalConstraints property that can be set to a DocumentSetConstraint component, which you can use to specify additional site constraints. For example, you could create a constraint that restricts unstructured content such as articles from being returned on a certain site.

MultisiteConstraint has an additionalConstraintsOperation property for specifying whether the generated constraint and the constraint specified through additionalConstraints should be combined using AND or OR Boolean operators. The default for this property is and.