Synonym-based search doesn't produce the same result as replacing the synonym manually

Hi!

I’m currently running into a problem where two searches that should in my mind produce the same results… don’t.

I can reproduce this in a relatively minimal example, so here are my two records:

[
  {
    "objectID": 1,
    "countries": [
      "Australia",
      "Austria",
      "Belgium",
      "Bulgaria",
      "Canada",
      "Denmark",
      "England and Wales",
      "Finland",
      "France",
      "Iceland",
      "Italy",
      "Japan",
      "Netherlands",
      "New Zealand",
      "Northern Ireland",
      "Norway",
      "Portugal",
      "Scotland",
      "Spain",
      "Sweden",
      "Switzerland",
      "United States",
      "United Kingdom",
      "Afghanistan",
      "Africa",
      "Albania",
      "Algeria",
      "American Samoa",
      "Andorra",
      "Angola",
      "Anguilla",
      "Antigua and Barbuda",
      "Argentina",
      "Armenia",
      "Aruba",
      "Asia",
      "Azerbaijan",
      "Bahamas",
      "Bahrain",
      "Bangladesh",
      "Barbados",
      "Belarus",
      "Belize",
      "Benin",
      "Bermuda",
      "Bhutan",
      "Bolivia",
      "Bonaire Sint Eustatius and Saba",
      "Bosnia and Herzegovina",
      "Botswana",
      "Brazil",
      "British Virgin Islands",
      "Brunei",
      "Burkina Faso",
      "Burundi",
      "Cape Verde",
      "Cambodia",
      "Cameroon",
      "Cayman Islands",
      "Central African Republic",
      "Chad",
      "Chile",
      "China",
      "Hong Kong",
      "Macao",
      "Taiwan",
      "Colombia",
      "Comoros",
      "Congo",
      "Cook Islands",
      "Costa Rica",
      "Croatia",
      "Cuba",
      "Curacao",
      "Cyprus",
      "Czechia",
      "Cote d'Ivoire",
      "North Korea",
      "Democratic Republic of Congo",
      "Djibouti",
      "Dominica",
      "Dominican Republic",
      "Ecuador",
      "Egypt",
      "El Salvador",
      "Equatorial Guinea",
      "Eritrea",
      "Estonia",
      "Eswatini",
      "Ethiopia",
      "Europe",
      "Falkland Islands",
      "Faroe Islands",
      "Fiji",
      "French Guiana",
      "French Polynesia",
      "Gabon",
      "Gambia",
      "Georgia",
      "Germany",
      "Ghana",
      "Gibraltar",
      "Greece",
      "Greenland",
      "Grenada",
      "Guadeloupe",
      "Guam",
      "Guatemala",
      "Guernsey",
      "Guinea",
      "Guinea-Bissau",
      "Guyana",
      "Haiti",
      "High-income countries",
      "Honduras",
      "Hungary",
      "India",
      "Indonesia",
      "Iran",
      "Iraq",
      "Ireland",
      "Isle of Man",
      "Israel",
      "Jamaica",
      "Jersey",
      "Jordan",
      "Kazakhstan",
      "Kenya",
      "Kiribati",
      "Kosovo",
      "Kuwait",
      "Kyrgyzstan",
      "Land-locked Developing Countries (LLDC)",
      "Laos",
      "Latin America and the Caribbean",
      "Latvia",
      "Least developed countries",
      "Lebanon",
      "Lesotho",
      "Less developed regions",
      "Less developed regions, excluding China",
      "Less developed regions, excluding least developed countries",
      "Liberia",
      "Libya",
      "Liechtenstein",
      "Lithuania",
      "Low-income countries",
      "Lower-middle-income countries",
      "Luxembourg",
      "Madagascar",
      "Malawi",
      "Malaysia",
      "Maldives",
      "Mali",
      "Malta",
      "Marshall Islands",
      "Martinique",
      "Mauritania",
      "Mauritius",
      "Mayotte",
      "Mexico",
      "Micronesia (country)",
      "Middle-income countries",
      "Monaco",
      "Mongolia",
      "Montenegro",
      "Montserrat",
      "More developed regions",
      "Morocco",
      "Mozambique",
      "Myanmar",
      "Namibia",
      "Nauru",
      "Nepal",
      "New Caledonia",
      "Nicaragua",
      "Niger",
      "Nigeria",
      "Niue",
      "No income group available",
      "North Macedonia",
      "Northern America",
      "Northern Mariana Islands",
      "Oceania",
      "Oman",
      "Pakistan",
      "Palau",
      "Panama",
      "Papua New Guinea",
      "Paraguay",
      "Peru",
      "Philippines",
      "Poland",
      "Puerto Rico",
      "Qatar",
      "South Korea",
      "Moldova",
      "Romania",
      "Russia",
      "Rwanda",
      "Reunion",
      "Saint Barthelemy",
      "Saint Helena",
      "Saint Kitts and Nevis",
      "Saint Lucia",
      "Saint Martin (French part)",
      "Saint Pierre and Miquelon",
      "Saint Vincent and the Grenadines",
      "Samoa",
      "San Marino",
      "Sao Tome and Principe",
      "Saudi Arabia",
      "Senegal",
      "Serbia",
      "Seychelles",
      "Sierra Leone",
      "Singapore",
      "Sint Maarten (Dutch part)",
      "Slovakia",
      "Slovenia",
      "Small Island Developing States (SIDS)",
      "Solomon Islands",
      "Somalia",
      "South Africa",
      "South Sudan",
      "Sri Lanka",
      "Palestine",
      "Sudan",
      "Suriname",
      "Syria",
      "Tajikistan",
      "Thailand",
      "East Timor",
      "Togo",
      "Tokelau",
      "Tonga",
      "Trinidad and Tobago",
      "Tunisia",
      "Turkmenistan",
      "Turks and Caicos Islands",
      "Tuvalu",
      "Turkey",
      "Uganda",
      "Ukraine",
      "United Arab Emirates",
      "Tanzania",
      "United States Virgin Islands",
      "Upper-middle-income countries",
      "Uruguay",
      "Uzbekistan",
      "Vanuatu",
      "Venezuela",
      "Vietnam",
      "Wallis and Futuna",
      "Western Sahara",
      "World",
      "Yemen",
      "Zambia",
      "Zimbabwe",
      "Americas",
      "USSR"
    ]
  },
  {
    "objectID": 2,
    "countries": ["Australia", "United Arab Emirates"]
  }
]

Otherwise, this index is set up with the synonym UAE <-> United Arab Emirates, and the only searchable attribute is unordered(countries).


Then, when searching for “UAE”, I only get back one result (objectID 2).

On the other hand, when searching for “United Arab Emirates”, I get back both of these results.

This is entirely unexpected to me; I would expect both of these queries to produce the same results. It seems that synonym-based matching stops after 100-or-so entries in a list.

Is this a known limitation? Could anyone point me in the right direction here?

Thanks,
Marcel


Screenshots of the situation

Screenshots of the Algolia dashboard

Query “uae”

Query “united arab emirates”


If need be, this problem can be reproduced in Algolia application 74GKBOIDJQ, index name marcel-test-2.