QueryBuilder throws InvalidQueryException if node path contains '-<num>e'
- Dominant language
- PHP
- Stars
- 181
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
When querying for children of node with path which contains `-e`, Query Builder throws InvalidQueryException.
```
$path = '/cms/site1/routes/it/home/test-1e';
$qb = $this->manager->createQueryBuilder();
$qb->fromDocument(AutoRoute::class, 'a');
$qb->where()->child($path, 'a');
$out = $qb->getQuery()->execute();
```
STEP 1:
/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Client.php line 888
$querystring = $query->getStatement();
$querystring has value:
```
SELECT * FROM [nt:unstructured] AS a WHERE (ISCHILDNODE(a, [/cms/site1/routes/it/home/test-1e]) AND (a.[phpcr:class] = 'MyCompany\Bundle\CMSBundle\Document\CMS\AutoRoute' OR a.[phpcr:classparents] = 'MyCompany\Bundle\CMSBundle\Document\CMS\AutoRoute'))
```
STEP 2:
/vendor/jackalope/jackalope-jackrabbit/src/Jackalope/Transport/Jackrabbit/Request.php line 529
$response = $curl->exec();
$response has value:
```
javax.jcr.query.InvalidQueryExceptionQuery:
SELECT * FROM [nt:unstructured] AS a WHERE (ISCHILDNODE(a, [/cms/site1/routes/it/home/test-(*)1e]) AND (a.[phpcr:class] = 'MyCompany\Bundle\CMSBundle\Document\CMS\AutoRoute' OR a.[phpcr:classparents] = 'MyCompany\Bundle\CMSBundle\Document\CMS\AutoRoute'))
```
As you can see above, it seems that someone is adding '(*)' to the JCR query.
This only happens if node's path contains `-e`.
Does anyone have any solutions?
Contributor guide
Research direction
Start with the query construction and execution points reported in vendor/jackalope/jackrabbit/src/Jackalope/Transport/Jackrabbit/Client.php line 888 and Request.php line 529. Reproduce the child query using the path ending in test-1e, then trace where the path becomes test-(*)1e in the JCR statement. Done means the original path is sent unchanged and the query no longer raises InvalidQueryException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100