Multiple documents having equal search score in Atlas Search

I’m having issues getting the right/best translation for ‘hi’ from English to French. After some debugging I discovered that the first three(3) documents returned from my aggregation has the same score of ‘2.362138271331787’ each.

I’m expecting ‘hi’ to have a higher score since it has an exact match with the same search query, but ‘it’s his’ and ‘his’ seems to have the same score too with ‘hi’.

Here’s my search query:

const searchOption = [
  {
    $search: {
      text: {
        query: "hi",
        path: "english",
      },
    },
  },
  { $project: { _id: 0, french: 1, english: 1, score: { $meta: "searchScore" } } },
  { $limit: 5 },
];

const result = await Greetings.aggregate(searchOption, { cursor: { batchSize: 5 } }).toArray();

Here’s are the documents returned. The list is ordered by search score:

[
  {
    english: "it’s his",
    french: "c'est le sien",
    score: 2.362138271331787,
  },
  {
    english: "hi",
    french: "salut",
    score: 2.362138271331787,
  },
  {
    english: "his",
    french: "le sien",
    score: 2.362138271331787,
  },
  {
    english: "it’s his failure to arrange his",
    french: "c'est son incapacité à organiser son",
    score: 2.2482824325561523,
  },
  {
    english: "it’s his failure to arrange his time",
    french: "c'est son incapacité à organiser son temps",
    score: 2.0995540618896484,
  },
];

Hi @Chukwuemeka_Maduekwe,

Thanks for sharing the pipeline details and the output you’re currently receiving.

Can you confirm the following details:

  1. The Index Analyser settings
  2. The Search Analyser settings
  3. If Dynamic Mappings are enabled
  4. Any field mappings

Regards,
Jason

Index Analyzer: lucene.standard
Search Analyzer: lucene.standard
Dynamic Mapping On

{
  "mappings": {
    "dynamic": true,
    "fields": {
      "english": [
        {
          "dynamic": true,
          "type": "document"
        },
        {
          "analyzer": "lucene.english",
          "searchAnalyzer": "lucene.english",
          "type": "string"
        }
      ],
      "french": [
        {
          "dynamic": true,
          "type": "document"
        },
        {
          "analyzer": "lucene.french",
          "searchAnalyzer": "lucene.french",
          "type": "string"
        }
      ],
      "spanish": [
        {
          "dynamic": true,
          "type": "document"
        },
        {
          "analyzer": "lucene.spanish",
          "searchAnalyzer": "lucene.spanish",
          "type": "string"
        }
      ]
    }
  }
}