Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-2733

RepositoryException in xpath query with the "OR" keyword

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.6.2, 2.1, 2.1.1
    • None
    • query, xpath
    • None

    Description

      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')]

      Attachments

        Activity

          People

            Unassigned Unassigned
            fgiust Fabrizio Giustina
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: