How to search with special characters in Atlas search?

I am trying to search M&S in the collection but it returns results with contain data like - m/s

I tried using / before the word & but still, it gives me the same result!

db.getCollection("article_fulltext").aggregate([
  {
    '$search': {
      'index': 'fulltext', 
      'text': {
        'query': 'm&s', 
        'path': 'fulltext'
      }
    }
  }
])

How will I search so that it can return the exact word in the atlas search?

how can we make & searchable in atlas search like - m&s, Marks & spencer, h & M.

Hello @Utsav_Upadhyay2 ,

I notice you haven’t had a response to this topic yet - were you able to find a solution?
If not, could you please help me understand below things from your use-case?

  • What do you mean by same result?
  • Please provide some sample documents with index definition.

As you are working with special characters, please take a look at examples in below documentation to see if this works for your use-case

Regards,
Tarun

Hi @Tarun_Gaur thank you for your response,

I tried using / before the word & but still, it gives me the same result!
The Above line means I am getting a result that is not filtered with the M&S keyword.

I am using a simple analyzer not White space because I need language-neutral & grammar-based tokenization.