Is there a way to use Query Builder to find a multi-value property that does NOT containt a particular value?
For instance, we have a "language" property that is a multi-value String. Can Query Builder find a node where the language property does not contain 'en' (English)?
You got confused between 'exists' and 'not'
“equals” for exact match (default),
“unequals” for unequality comparison,
“like” for using the jcr:like xpath function ,
“not” for no match ,
“exists” for existence match
Yes, It is not giving results as expected using QueryBuilder but with XPATH it does.
I would suggest you can go with SQL2 query instead of Query Builder.
The last XPATH query, I've shared which gives result when there is no language property or no 'en' value for language property.
If you want to check both conditions just put one more condition with AND.
@language and not(jcr:like(@language, 'en'))
Arun - Your XPath example helped me understand why we were getting different results.
Though I'm working on a solution that uses Query Builder via the Java API, I tested this through the Query Builder Debugger. When I put these parameters into the Debugger:
here is the XPath that it generates:
Notice that it ignored "property.value".
However, when I add the additional "jcr:like" from your XPath example above and run the modified XPath query in the CRX Query tool:
it works as expected. While it still returns nodes without the "language" property, it also includes nodes that have the "language" property but do not have an "en" value.
I am assuming that the Query Builder Java API behaves the same, translating to the same XPath query (or SQL2 equivalent) underneath.
We are using AEM 6.1 SP2. Is it possible that Query Builder in this version behaves differently than in newer version?
Just tested Arun;s response - this compiles --
Just tested this - it compiles and works to query We Retail pages using QueryBuilder.
Map<String, String> map = new HashMap<String, String>();
//set QueryBuilder search criteria
In hoping to find an undocumented predicate feature, I experimented with using multiple "operation" properties for "property". For example:
This didn't seem to work.