Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

com.day.cq.search.impl.builder.QueryImpl Could not run xpath query

Avatar

Level 3

Hello all

Any help appreciated. The below query runs without issue on 6.1, but throws javax.jcr.query.InvalidQueryException: java.text.ParseException on 6.3.

The cause could not be missing content could it?

Has there been a breaking change in the query builder implementation?

(/jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/specialOffersPage') and ((jcr:content/@startDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))] | /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/specialOffersPage') and ((jcr:content/@startDate < xs:dateTime('2017-10-05T00:00:00.000+02:00')) and (jcr:content/@endDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))] | /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/eventPage') and ((jcr:content/@startDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))] | /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/eventPage') and ((jcr:content/@startDate < xs:dateTime('2017-10-05T00:00:00.000+02:00')) and (jcr:content/@endDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))] | /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/promotionPage') and ((jcr:content/@startDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))] | /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/promotionPage') and ((jcr:content/@startDate < xs:dateTime('2017-10-05T00:00:00.000+02:00')) and (jcr:content/@endDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))]) order by jcr:content/@startDate converted to SQL-2 Query: select [jcr:path], [jcr:score], * from [cq:Page] as a where [jcr:content/cq:template] = '/apps/suninternational/templates/specialOffersPage' and [jcr:content/startDate] >= cast('2017-10-05T00:00:00.000+02:00' as date) and isdescendantnode(a, '/content/suninternational') /* xpath: /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/specialOffersPage') and ((jcr:content/@startDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))]  order by jcr:content/@startDate */ union select [jcr:path], [jcr:score], * from [cq:Page] as a where [jcr:content/cq:template] = '/apps/suninternational/templates/specialOffersPage' and [jcr:content/startDate] < cast('2017-10-05T00:00:00.000+02:00' as date) and [jcr:content/endDate] >= cast('2017-10-05T00:00:00.000+02:00' as date) and isdescendantnode(a, '/content/suninternational') /* xpath: /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/specialOffersPage') and ((jcr:content/@startDate < xs:dateTime('2017-10-05T00:00:00.000+02:00')) and (jcr:content/@endDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))]  order by jcr:content/@startDate */ order by [jcr:content/startDate] union(*)select [jcr:path], [jcr:score], * from [cq:Page] as a where [jcr:content/cq:template] = '/apps/suninternational/templates/eventPage' and [jcr:content/startDate] >= cast('2017-10-05T00:00:00.000+02:00' as date) and isdescendantnode(a, '/content/suninternational') /* xpath: /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/eventPage') and ((jcr:content/@startDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))]  order by jcr:content/@startDate */ order by [jcr:content/startDate] union select [jcr:path], [jcr:score], * from [cq:Page] as a where [jcr:content/cq:template] = '/apps/suninternational/templates/eventPage' and [jcr:content/startDate] < cast('2017-10-05T00:00:00.000+02:00' as date) and [jcr:content/endDate] >= cast('2017-10-05T00:00:00.000+02:00' as date) and isdescendantnode(a, '/content/suninternational') /* xpath: /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/eventPage') and ((jcr:content/@startDate < xs:dateTime('2017-10-05T00:00:00.000+02:00')) and (jcr:content/@endDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))]  order by jcr:content/@startDate */ order by [jcr:content/startDate] union select [jcr:path], [jcr:score], * from [cq:Page] as a where [jcr:content/cq:template] = '/apps/suninternational/templates/promotionPage' and [jcr:content/startDate] >= cast('2017-10-05T00:00:00.000+02:00' as date) and isdescendantnode(a, '/content/suninternational') /* xpath: /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/promotionPage') and ((jcr:content/@startDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))]  order by jcr:content/@startDate */ order by [jcr:content/startDate] union select [jcr:path], [jcr:score], * from [cq:Page] as a where [jcr:content/cq:template] = '/apps/suninternational/templates/promotionPage' and [jcr:content/startDate] < cast('2017-10-05T00:00:00.000+02:00' as date) and [jcr:content/endDate] >= cast('2017-10-05T00:00:00.000+02:00' as date) and isdescendantnode(a, '/content/suninternational') /* xpath: /jcr:root/content/suninternational//element(*, cq:Page)[(jcr:content/@cq:template = '/apps/suninternational/templates/promotionPage') and ((jcr:content/@startDate < xs:dateTime('2017-10-05T00:00:00.000+02:00')) and (jcr:content/@endDate >= xs:dateTime('2017-10-05T00:00:00.000+02:00')))] order by jcr:content/@startDate */ order by [jcr:content/startDate]

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi all

Installing the Cumulative Fix Pack 6.3.0.2 resolved this issues. Without changing the query the problem was resolved.

Thanks

View solution in original post

5 Replies

Avatar

Level 10

The docs state that XPath is still valid - Query Builder API

Try shortening the xpath query and see if a basic one works.

Avatar

Level 10

I think issue is query is simply too long

Avatar

Community Advisor

Agree with scott. Can you first make sure if xpath query (more simple one) is working in 6.3 . Once that is sure, just do a trial and error by splitting your query into smaller ones and try one after the other (These are all for debugging and concluding that xpath is working and will fetch the results for your content).

Once the above is made sure working, as scott mentioned check if the very long query is causing a prob or not ?

Avatar

Level 10

Some of the syntaxes could have been changed. I would recommend to break this query to smaller chunks and execute them to identify which is the syntax that has broken in the newer version.

Once we identify that, then we should be able to see how to handle the same in 6.3

Avatar

Correct answer by
Level 3

Hi all

Installing the Cumulative Fix Pack 6.3.0.2 resolved this issues. Without changing the query the problem was resolved.

Thanks