Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-15235

Regex query returns incorrect results when index is present

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.4.11, 2.6.3, 2.7.6
    • Fix Version/s: 2.8.0-rc1
    • Component/s: Querying
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      See regex_different_results_with_index.js

      Show
      See regex_different_results_with_index.js

      Description

      We've noticed a strange issue where a regex query on a field returns different results, depending on whether there is an index defined on that field or not.

      I've included a JS test file (regex_different_results_with_index.js) which reproduces the issue.

      The regex is left-anchored. Also, an equavilent regex expression (included in JS) works in both cases:

      • /^(a(a|$)|b)/ : works both with and without index
      • /^a(a|$)|^b/ : works without an index, does not work with an index

      Looking at the regex expression, the result without the index (both "aa" and "bb" match) should be the correct one. When the index is present, only "aa" is returned, which is incorrect.

      I have tested this on 2.4.11 and 2.6.3.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              david.storch David Storch
              Reporter:
              victor.hooi Victor Hooi
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: