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

Invalid query results when using jcr:like with a case transform function and a pattern not starting with a wildcard

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4, core 1.4.1
    • Fix Version/s: core 1.4.2
    • Component/s: jackrabbit-core, query
    • Labels:
      None
    • Environment:
      Ubuntu gutsy, Sun JDK 1.5.0_08

      Description

      If the repository contains nodes with the following value for the property name :
      john
      JOhn
      joe
      Joey

      and we run the following query :
      //element(, document)/[jcr:like(fn:lower-case(@name), 'joh%')]")
      then all the previous nodes will match especially the last 2 nodes.

      The reason is the use of two range scans from the lucene term index:
      ..._name_jOH
      ..................
      ...name_joh

      and

      ..._name_JOH
      ..................
      ...name_Joh

      The first range will contains ..._name_joe property and the second will contains ..._name_Joey.
      But the pattern 'joh%' and so the regexp '.*' because of the range scan will match
      the substring values of the properties ('' in the first range and 'y' in the second range).

      The solution is to use the full pattern (ie 'joh.*') for matching each properties.

        Attachments

        1. jackrabbit-1.4.x-query-like.patch
          4 kB
          Sébastien Launay

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              yabon Sébastien Launay
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: