I'm tying to use groups in a Query to get pages by Tags. I want to select the members that match at least 1 item in both Group 1 and Group 2 so, like this:
( A or B ) AND ( 1 or 2 )
My query is successful and gives expected results when I supply a single item to the first pair ( A or B ) and multiple values to the second pair, but if I supply multiple values to the first pair I get no results instead of additive results.
I'm using AEM 6.1 (upgrade soon!).
The predicate strings are nearly identical so I'm wondering if I'm using the "x_group.p.or = true" correctly or in the right places. Below are the two queries I'm generating. How can I fix my query to achieve ( A or B ) AND ( 1 or 2 )?
This returns expected results:
ROOT=group: hits=full, limit=-1[
{orderby=orderby: orderby=@jcr:content/jcr:title, sort=asc}
{path=path: path=/content/bc-web/test/discernment}
{type=type: type=cq:Page}
{1_property=property: property=jcr:content/sling:resourceType, value=bc-web/components/page/bc-school-major}
{2_group=group: or=true[
{1_property=property: property=jcr:content/cq:tags, value=bc:schools/MCAS/schools/math}
]}
{3_group=group: or=true[
{1_tagid=tagid: property=jcr:content/cq:tags, tagid=/etc/tags/bc/schools/degrees/BS}
{2_tagid=tagid: property=jcr:content/cq:tags, tagid=/etc/tags/bc/schools/degrees/BA}
]}
]
This returns no results (difference in green):
ROOT=group: hits=full, limit=-1[
{orderby=orderby: orderby=@jcr:content/jcr:title, sort=asc}
{path=path: path=/content/bc-web/test/discernment}
{type=type: type=cq:Page}
{1_property=property: property=jcr:content/sling:resourceType, value=bc-web/components/page/bc-school-major}
{2_group=group: or=true[
{1_property=property: property=jcr:content/cq:tags, value=bc:schools/MCAS/schools/math}
{2_property=property: property=jcr:content/cq:tags, value=bc:schools/MCAS/schools/physics}
]}
{3_group=group: or=true[
{1_tagid=tagid: property=jcr:content/cq:tags, tagid=/etc/tags/bc/schools/degrees/BS}
{2_tagid=tagid: property=jcr:content/cq:tags, tagid=/etc/tags/bc/schools/degrees/BA}
]}
]
The Java that creates this is:
Map<String, String> map = new HashMap<String, String>();
map.put("path", this.getPathToMajors());
map.put("type", "cq:Page");
map.put("1_property", "jcr:content/sling:resourceType");
map.put("1_property.value", "bc-web/components/page/bc-school-major");
if (null != getTagFilter() && (filterCount > 0)) {
map.put("2_group.p.or", "true");
for (int i = 0; i < filterCount; i++) {
int group = i + 1;
String key1 = "2_group." + group + "_property.value";
String key2 = "2_group." + group + "_property";
map.put(key1, getTagFilter()[i]);
map.put(key2, "jcr:content/cq:tags");
}
}
if (null != getTagLimit() && (limitCount > 0)) {
map.put("3_group.p.or", "true");
for (int j = 0; j < limitCount; j++) {
int group = j + 1;
String key1 = "3_group." + group + "_tagid";
String key2 = "3_group." + group + "_tagid.property";
map.put(key1, getTagLimit()[j]);
map.put(key2, "jcr:content/cq:tags");
}
}
map.put("p.hits", "full");
map.put("orderby", "@jcr:content/jcr:title");
map.put("orderby.sort", "asc");
map.put("p.limit", "-1");
Views
Replies
Total Likes