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

Case sensitive text queries should match against full tokens instead of stemmed tokens

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 3.1.0
    • Text Search
    • Fully Compatible
    • ALL
    • Hide

      load('jstests/libs/fts.js'); // for getIDS
       
      var t = db.fts_case_sensitive;
      t.drop();
       
      t.ensureIndex({a: 'text'});
      t.insert({_id: 0, a: 'swiftly'});
      t.insert({_id: 1, a: 'swiftlY'});  // capital y in the suffix
       
      var res = t.find({$text: {$search: 'swiftly', $caseSensitive: true}});
       
      // only the first result should be returned for the case sensitive query
      assert.eq(getIDS(res), [0]);
      

      Show
      load('jstests/libs/fts.js'); // for getIDS   var t = db.fts_case_sensitive; t.drop();   t.ensureIndex({a: 'text'}); t.insert({_id: 0, a: 'swiftly'}); t.insert({_id: 1, a: 'swiftlY'}); // capital y in the suffix   var res = t.find({$text: {$search: 'swiftly', $caseSensitive: true}});   // only the first result should be returned for the case sensitive query assert.eq(getIDS(res), [0]);
    • Platform A (10/09/15)

    Description

      $text queries with $caseSensitive: true match against stemmed tokens instead of full tokens:

      > var t = db.fts_case_sensitive;
       
      > t.insert({_id: 0, a: 'swiftly'});
      WriteResult({ "nInserted" : 1 })
       
      > t.insert({_id: 1, a: 'swiftlY'});  // capital y in the suffix
      WriteResult({ "nInserted" : 1 })
       
      > t.find()
      { "_id" : 0, "a" : "swiftly" }
      { "_id" : 1, "a" : "swiftlY" }
       
      > t.find({$text: {$search: 'swiftly', $caseSensitive: true}});
      { "_id" : 0, "a" : "swiftly" }
      { "_id" : 1, "a" : "swiftlY" } // this is an unexpected result because of the capital y
      

      Attachments

        Activity

          People

            mark.benvenuto@mongodb.com Mark Benvenuto
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: