Any null value encountered by a targeter is interpreted to mean “this value is unknown.” If any such unknown values are encountered during rule evaluation or query execution, the corresponding repository items are not included in the targeting results. For example, consider the rule
<rule op=eq>
<valueof bean="Profile.ageGroup">
<valueof target="ageGroup">
</rule>
This rule might encounter null values in two cases:
If
Profile.ageGroupevaluates to null, we deduce that the user did not specify his age, and hisageGroupis therefore unknown. In this case, no content should be returned by this rule.If
Profile.ageGroupevaluates toTeenagers, the only items returned from the repository query should be the ones withageGroupequal toTeenagers. A content item with a nullageGroupvalue should not be returned, since itsageGroupproperty is considered to be unknown.
The less intuitive case is the case with rules that use negative rule operators, such as neq. For example:
<rule op=neq>
<valueof bean="Profile.ageGroup">
<valueof target="forbiddenAgeGroup">
</rule>
Here again,
If
Profile.ageGroupevaluates to null, theageGroupis unknown, and no content is returned.If
Profile.ageGroupevaluates toTeenagers, the only items returned from the repository query should be the ones which have theforbiddenAgeGroupproperty set to something other thanTeenagers- but not null. Items whoseforbiddenAgeGroupproperty is null should not be returned, since theirforbiddenAgeGroupis unknown.
The principle behind this treatment of null values is that when the user doesn’t specify a value for one of his properties, or when the content creator does not specify a value for one of the content attributes, that unspecified value in actuality may or may not match the rule condition we are trying to satisfy. If there is a possibility that the condition may not be satisfied, we always err on the conservative side and do not include the questionable people or content. If you want to include items with null values, then add a term to the rule with an or rule operator, like this:
<rule op=or>
<rule op=eq>
<valueof bean="Profile.ageGroup">
<valueof target="ageGroup">
</rule>
<rule op=isNull>
<valueof target="ageGroup">
</rule>
</rule>
This rule returns all content items whose ageGroup attribute matches the profile’s ageGroup, and also all content items whose ageGroup attribute is null.

