You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Amir Mistric <am...@nemours.org> on 2007/06/24 19:55:02 UTC

Escaped apostrophe in query fails

After some testing I noticed that following queries:


/jcr:root/company//*[@jcr:primaryType='mgnl:content']//*[jcr:contains(.,'children''s health')]

/jcr:root/company//*[@jcr:primaryType='mgnl:content']//*[jcr:contains(.,'children''s')]

/jcr:root/company//*[@jcr:primaryType='mgnl:content']//*[jcr:contains(.,'children '' s health')]

/jcr:root/company//*[@jcr:primaryType='mgnl:content']//*[jcr:contains(.,'children '' s')]


All fail with:

13:50:05,744 ERROR [STDERR] javax.jcr.RepositoryException: Exception building query: org.apache.jackrabbit.core.query.lucene.fulltext.ParseException: Lexical error at line 1, column 11.  Encountered:
<EOF> after : "\"s"
13:50:05,744 ERROR [STDERR]     at org.apache.jackrabbit.core.query.lucene.LuceneQueryBuilder.createQuery(LuceneQueryBuilder.java:174)
13:50:05,744 ERROR [STDERR]     at org.apache.jackrabbit.core.query.lucene.QueryImpl.execute(QueryImpl.java:145)
13:50:05,744 ERROR [STDERR]     at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:139)


Either I am not escaping the single quote correctly or this is a bug...

Regards
Amir

Re: Escaped apostrophe in query fails

Posted by Marcel Reutegger <ma...@gmx.net>.
Amir Mistric wrote:
> /jcr:root/company//*[@jcr:primaryType='mgnl:content']//*[jcr:contains(.,'children''s health')]
> 
> /jcr:root/company//*[@jcr:primaryType='mgnl:content']//*[jcr:contains(.,'children''s')]
> 
> /jcr:root/company//*[@jcr:primaryType='mgnl:content']//*[jcr:contains(.,'children '' s health')]
> 
> /jcr:root/company//*[@jcr:primaryType='mgnl:content']//*[jcr:contains(.,'children '' s')]
> 
> All fail with:
> 
> 13:50:05,744 ERROR [STDERR] javax.jcr.RepositoryException: Exception building query: org.apache.jackrabbit.core.query.lucene.fulltext.ParseException: Lexical error at line 1, column 11.  Encountered:
> <EOF> after : "\"s"
> 13:50:05,744 ERROR [STDERR]     at org.apache.jackrabbit.core.query.lucene.LuceneQueryBuilder.createQuery(LuceneQueryBuilder.java:174)
> 13:50:05,744 ERROR [STDERR]     at org.apache.jackrabbit.core.query.lucene.QueryImpl.execute(QueryImpl.java:145)
> 13:50:05,744 ERROR [STDERR]     at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:139)

This is a bug in jackrabbit. See http://issues.apache.org/jira/browse/JCR-980.

regards
  marcel