com.day.cq.search.impl.builder.QueryImpl Could not run xpath query | Community
Skip to main content
kabelol26243436
Level 2
October 5, 2017
Solved

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

  • October 5, 2017
  • 5 replies
  • 2019 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kabelol26243436

Hi all

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

Thanks

5 replies

smacdonald2008
Level 10
October 5, 2017

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

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

smacdonald2008
Level 10
October 5, 2017

I think issue is query is simply too long

VeenaVikraman
Community Advisor
Community Advisor
October 5, 2017

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 ?

Lokesh_Shivalingaiah
Level 10
October 5, 2017

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

kabelol26243436
kabelol26243436AuthorAccepted solution
Level 2
October 9, 2017

Hi all

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

Thanks