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

Full Text Search incorrectly matches partial ID-like phrases

    • Query Integration
    • ALL
    • Hide
      1. Add a document to a collection, something like {{ { "value": "123-X-1 Hello" }

        }}

      2. Add a text index on the value property
      3. Perform a text search with something like {{ { $text: \{$search: '"23-X-1"' }

        }}}

      Show
      Add a document to a collection, something like {{ { "value": "123-X-1 Hello" } }} Add a text index on the value property Perform a text search with something like {{ { $text: \{$search: '"23-X-1"' } }}}

      It’s my understanding that $text searches do not match partial words or phrases. However, when I am searching in my MongoDB with a text index, it is returning matches that partially match an ID-like search query, for example:

      This search:

      {{{ $text: {$search: '"23-X-1"' }}}}

      Matches this document:

      {{

      { "value": "123-X-1 Hello" }

      }}

      Especially since it is quoted, I’d expect it to not match, since the phrase "23-X-1" doesn’t appear isolated anywhere in the value, but only appears as a partial match of the greater phrase "123-X-1".

        1. repro.js
          0.4 kB
          Rhea Thorne

            Assignee:
            kateryna.kamenieva@mongodb.com Katya Kamenieva
            Reporter:
            eric@ericmakesapps.com Eric Ferreira
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: