0
votes

Hi I'm trying to search a node whose name is "MainReference" and contains a property "id" whose value is either equal to "FK123456" or "123456" inside a given path. When I'm doing this using the query builder in the code, then it's working fine. For that I'm using this statement:

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE(['/etc/commerce/products/flipkart']) and CONTAINS(s.*, 'MainReference')and (s.['id']='FK123456' OR s.['id']='123456' ) 

but when I'm trying to search for it using crxdelite --> Tools --> query, using this statement:

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE(s,'/etc/commerce/products/flipkart')  and  CONTAINS NAME() = 'MainReference' and (s.id, 'FK123456' OR s.id='123456')

It gives some kinf of error in the statement.

Can you please help me out? How can I execute the same query using the query tool in the search function.

Type of query is SQL2 error is -- SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE(s,'/etc/commerce/products/flipkart') and CONTAINS NAME() = 'MainReference' and (s.id, 'FK123456' OR s.id='123456'); expected: (, ., =, <>, <, >, <=, >=, LIKE, IS, NO

1
what version of AEM are you using?Sharath Madappa
What's the error? Can you post it here?toniedzwiedz
Type of query is SQL2 error is -- SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE(s,'/etc/commerce/products/flipkart') and CONTAINS NAME() = 'MainReference' and (s.id, 'FK123456' OR s.id='123456'); expected: (, ., =, <>, <, >, <=, >=, LIKE, IS, NOuser2142786

1 Answers

0
votes

You have an obvious error there - you have contains at wrong place there. Also you even do not need it. Try this one:

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE(s,'/etc/commerce/products')  and  NAME() = 'MainReference' and (s.id='FK123456' OR s.id='123456')