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

$text OR condition on phrases not working

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Integration
    • ALL
    • QI 2023-05-29, QI 2023-06-12

      Hello ,

      I think i have found a bug with $text command which is used to invoke the text indexes. The command fails when we are trying to search for multiple phrases and use an OR condition. for example:
      find({'$text':{'$search':'\"\"works at company1\" \"Adam\" \"'}})

       This command tokenizes the first phrase and gets documents having 'works' keyword OR 'company1' keyword OR 'Adam' keyword. which is not what we want.  We want the command to get 'works at walee' phrase which is not what the command does.

      the AND command:
      find({'$text':{'$search':'\"works at company1\" \"Adam\" '}})

      works fine and only gets documents which has both the phrase and the keyword doing exact phrase matching .

            Assignee:
            arun.banala@mongodb.com Arun Banala
            Reporter:
            abdmateen@gmail.com Abdul Mateen Ahmad Khan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: