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

Text Search not working properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Text Search
    • Labels:
      None
    • Operating System:
      ALL

      Description

      When I hit the query:
      db.sample.find({ $text:

      { $search: "cakes \"coffee shop\"" }

      })

      I get only one result:

      /* 1 */
      {
          "_id" : ObjectId("5ad609baac1a8b644180936b"),
          "content" : "coffee shop..."
      }
      

      Here is the data set:

      /* 1 */
      {
          "_id" : ObjectId("5ad609a2ac1a8b644180936a"),
          "content" : "Coffee and cakes..."
      }
       
      /* 2 */
      {
          "_id" : ObjectId("5ad609baac1a8b644180936b"),
          "content" : "coffee shop..."
      }
      

      Text index was already created for content field.

      As per the mongo docs here:
      https://docs.mongodb.com/manual/text-search/

      It says it returns all documents containing “coffee shop” OR “cakes”. So it should return both documents. It isnt happening here.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: