Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-8685

[Backport 7.9] - Search in the cms with an apostrophe ' gives a stacktrace and no results

    XMLWordPrintable

Details

    Description

      When searching for a phrase with a single quote ' in the term in the cms then this gives an error with a stacktrace and no results.

      Repoduction:

      • login the cms
      • search for any phrase with a single quote: for instance te'st
      • see the following error (see attachment for complete stacktrace)

      Error executing query[text]:
      9c-a5d1-4e84-aec4-594e5bf93b25') and (jcr:contains(.,'te\'st') or jcr:contains(.,'te\'st*'))]/rep:excerpt(.) order by @jcr:score desc
      [INFO] [talledLocalContainer] javax.jcr.query.InvalidQueryException: Encountered "\') or jcr:contains(.,\'" at line 1, column 126.

      Fix:
      The issue lies in the TextSearchBuilder that tries to escape single quotes via a backslash '\' thus ' becomes \'
      According to JSR-170 spec v1.0, Sec. 6.6.4.9. single quotes need to be escaped via another single quote. Thus ' should become ''

      Tested this fix via the repository and it works on the archetype of hippo 7.8.5

      see the answer in: https://issues.apache.org/jira/browse/JCR-1748

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cngo Canh Ngo (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: