You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "fabrizio giustina (JIRA)" <ji...@apache.org> on 2010/08/29 09:14:53 UTC
[jira] Created: (JCR-2733) RepositoryException in xpath query with
the "OR" keyword
RepositoryException in xpath query with the "OR" keyword
--------------------------------------------------------
Key: JCR-2733
URL: https://issues.apache.org/jira/browse/JCR-2733
Project: Jackrabbit Content Repository
Issue Type: Bug
Components: query, xpath
Affects Versions: 2.1.1, 2.1.0, 1.6.2
Reporter: fabrizio giustina
Any string literal starting with "OR ", e.g.:
//*[jcr:contains(@title, 'OR ME')]
ends up in a javax.jcr.RepositoryException:
Exception building query: org.apache.lucene.queryParser.ParseException: Cannot parse 'OR ME': Encountered " <OR> "OR "" at line 1, column 0.
I see this is due to the "OR" keyword interpreted by Lucene, like described in http://stackoverflow.com/questions/1311304/keyword-or-and-search-in-lucene
Is this expected? Shouldn't jackrabbit escape the input string before creating the lucene query, since this is implementation-specific and OR should not AFAIK be a reserved word in properly delimited string literals in xpath queries?
Also note that the similar "AND" keyword doesn't cause any problem.
In order to fix it I must check and replace any input string starting with "OR" adding quotes or lowercasing:
//*[jcr:contains(@title, '"OR" ME')]
//*[jcr:contains(@title, 'or ME')]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-2733) RepositoryException in xpath query
with the "OR" keyword
Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12904122#action_12904122 ]
Alexander Klimetschek commented on JCR-2733:
--------------------------------------------
This is ok, as Jackrabbit wants to make the Lucene full-text search language available through jcr:contains. If you don't want that, escaping using double-quotes as you did, is the way to go.
Not sure, but maybe this exception which seems to come only because there is no operand before the OR, could be handled more gracefully. Could you post the full stacktrace to see if this exception is thrown inside Lucene or by Jackrabbit.
> RepositoryException in xpath query with the "OR" keyword
> --------------------------------------------------------
>
> Key: JCR-2733
> URL: https://issues.apache.org/jira/browse/JCR-2733
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: query, xpath
> Affects Versions: 1.6.2, 2.1.0, 2.1.1
> Reporter: fabrizio giustina
>
> Any string literal starting with "OR ", e.g.:
> //*[jcr:contains(@title, 'OR ME')]
> ends up in a javax.jcr.RepositoryException:
> Exception building query: org.apache.lucene.queryParser.ParseException: Cannot parse 'OR ME': Encountered " <OR> "OR "" at line 1, column 0.
> I see this is due to the "OR" keyword interpreted by Lucene, like described in http://stackoverflow.com/questions/1311304/keyword-or-and-search-in-lucene
> Is this expected? Shouldn't jackrabbit escape the input string before creating the lucene query, since this is implementation-specific and OR should not AFAIK be a reserved word in properly delimited string literals in xpath queries?
> Also note that the similar "AND" keyword doesn't cause any problem.
> In order to fix it I must check and replace any input string starting with "OR" adding quotes or lowercasing:
> //*[jcr:contains(@title, '"OR" ME')]
> //*[jcr:contains(@title, 'or ME')]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-2733) RepositoryException in xpath query
with the "OR" keyword
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12904648#action_12904648 ]
Marcel Reutegger commented on JCR-2733:
---------------------------------------
Please note that OR is also a keyword in JCR 1.0. See: http://www.day.com/specs/jcr/1.0/6.6.5.2_jcr_contains_Function.html
> RepositoryException in xpath query with the "OR" keyword
> --------------------------------------------------------
>
> Key: JCR-2733
> URL: https://issues.apache.org/jira/browse/JCR-2733
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: query, xpath
> Affects Versions: 1.6.2, 2.1.0, 2.1.1
> Reporter: fabrizio giustina
>
> Any string literal starting with "OR ", e.g.:
> //*[jcr:contains(@title, 'OR ME')]
> ends up in a javax.jcr.RepositoryException:
> Exception building query: org.apache.lucene.queryParser.ParseException: Cannot parse 'OR ME': Encountered " <OR> "OR "" at line 1, column 0.
> I see this is due to the "OR" keyword interpreted by Lucene, like described in http://stackoverflow.com/questions/1311304/keyword-or-and-search-in-lucene
> Is this expected? Shouldn't jackrabbit escape the input string before creating the lucene query, since this is implementation-specific and OR should not AFAIK be a reserved word in properly delimited string literals in xpath queries?
> Also note that the similar "AND" keyword doesn't cause any problem.
> In order to fix it I must check and replace any input string starting with "OR" adding quotes or lowercasing:
> //*[jcr:contains(@title, '"OR" ME')]
> //*[jcr:contains(@title, 'or ME')]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.