Atlas search function score not applied for certain query

I have a query that applies my function score with 1 input but doesnt apply it with another input. Is this a bug or am I missing something?

Input: “cambridg”

{
  compound: {
    must: [
      {
        compound: {
          should: [
            {
              text: {
                path: 'type',
                query: 'COUNTRY',
                score: { constant: { value: 90000 } }
              }
            },
            {
              compound: {
                filter: [
                  { text: { path: 'type', query: 'POI' } },
                  { text: { path: 'poiType', query: 'ISLAND' } },
                  { equals: { path: 'hasGeometry', value: true } }
                ],
                score: { constant: { value: 80000 } }
              }
            },
            {
              compound: {
                filter: [
                  { text: { path: 'type', query: 'CITY' } },
                  { exists: { path: 'accommodationCount' } },
                  { range: { path: 'accommodationCount', gt: 0 } }
                ],
                score: { constant: { value: 70000 } }
              }
            },
            {
              text: {
                path: 'type',
                query: 'ADMINISTRATIVE_LEVEL',
                score: { constant: { value: 60000 } }
              }
            },
            {
              text: {
                path: 'type',
                query: 'CONTINENT',
                score: { constant: { value: 50000 } }
              }
            },
            {
              compound: {
                filter: [
                  { text: { path: 'type', query: 'POI' } },
                  {
                    compound: {
                      should: [
                        {
                          text: { path: 'poiType', query: 'ATTRACTION' }
                        },
                        {
                          text: { path: 'poiType', query: 'TRANSPORTATION' }
                        }
                      ],
                      minimumShouldMatch: 1
                    }
                  }
                ],
                score: { constant: { value: 40000 } }
              }
            },
            {
              compound: {
                filter: [ { text: { path: 'type', query: 'CITY' } } ],
                mustNot: [
                  { exists: { path: 'accommodationCount' } },
                  { range: { path: 'accommodationCount', gt: 0 } }
                ],
                score: { constant: { value: 30000 } }
              }
            },
            {
              compound: {
                filter: [ { text: { path: 'type', query: 'POI' } } ],
                mustNot: [
                  {
                    compound: {
                      should: [
                        {
                          compound: {
                            filter: [
                              {
                                text: { path: 'poiType', query: 'ISLAND' }
                              },
                              {
                                equals: { path: 'hasGeometry', value: true }
                              }
                            ]
                          }
                        },
                        {
                          text: { path: 'poiType', query: 'ATTRACTION' }
                        },
                        {
                          text: { path: 'poiType', query: 'TRANSPORTATION' }
                        }
                      ],
                      minimumShouldMatch: 1
                    }
                  }
                ],
                score: { constant: { value: 20000 } }
              }
            },
            {
              text: {
                path: 'type',
                query: 'CITY_DISTRICT',
                score: { constant: { value: 10000 } }
              }
            }
          ]
        }
      }
    ],
    filter: [
      {
        compound: {
          should: [
            { text: { path: 'type', query: 'POI' } },
            {
              compound: {
                should: [
                  { text: { path: 'type', query: 'COUNTRY' } },
                  {
                    text: { path: 'type', query: 'ADMINISTRATIVE_LEVEL' }
                  },
                  { text: { path: 'type', query: 'CITY' } }
                ],
                filter: [ { range: { path: 'accommodationCount', gt: 0 } } ],
                minimumShouldMatch: 1
              }
            }
          ],
          minimumShouldMatch: 1
        }
      }
    ],
    should: [
      {
        text: {
          query: 'cambridge',
          path: [
            { value: 'names', multi: 'keyword' },
            { value: 'alternateAndParentNames', multi: 'keyword' }
          ],
          score: { constant: { value: 2000000000 } }
        }
      },
      {
        wildcard: {
          query: 'cambridge*',
          allowAnalyzedField: true,
          path: [
            { value: 'names', multi: 'keyword' },
            { value: 'alternateAndParentNames', multi: 'keyword' }
          ],
          score: { constant: { value: 10000000 } }
        }
      },
      {
        text: {
          query: 'cambridge',
          path: [ { value: 'names' }, { value: 'alternateAndParentNames' } ],
          score: { constant: { value: 2000000 } }
        }
      },
      {
        wildcard: {
          query: 'cambridge*',
          allowAnalyzedField: true,
          path: [ { value: 'names' }, { value: 'alternateAndParentNames' } ],
          score: { constant: { value: 10000 } }
        }
      },
      {
        text: {
          query: 'cambridge',
          path: [ { value: 'names', multi: 'keyword' } ],
          score: { constant: { value: 20000000000 } }
        }
      },
      {
        wildcard: {
          query: 'cambridge*',
          allowAnalyzedField: true,
          path: [ { value: 'names', multi: 'keyword' } ],
          score: { constant: { value: 100000000 } }
        }
      },
      {
        text: {
          query: 'cambridge',
          path: [ { value: 'names' } ],
          score: { constant: { value: 20000000 } }
        }
      },
      {
        wildcard: {
          query: 'cambridge*',
          allowAnalyzedField: true,
          path: [ { value: 'names' } ],
          score: { constant: { value: 100000 } }
        }
      }
    ],
    minimumShouldMatch: 1,
    score: {
      function: {
        add: [
          { score: 'relevance' },
          { path: { value: 'accommodationCount', undefined: 0 } },
          { path: { value: 'searchBoost', undefined: 0 } }
        ]
      }
    }
  }
}

Gives output:

[
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'England', 'Cambridgeshire' ],
      countryName: 'United Kingdom of Great Britain and Northern Ireland'
    },
    searchScoreWithBoost: 110180264,
    searchScoreWithoutBoost: 110179997,
    accommodationCount: 267,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Waikato' ],
      countryName: 'New Zealand'
    },
    searchScoreWithBoost: 110180064,
    searchScoreWithoutBoost: 110180001,
    accommodationCount: 63,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Massachusetts' ],
      countryName: 'United States'
    },
    searchScoreWithBoost: 110180008,
    searchScoreWithoutBoost: 110179999,
    accommodationCount: 9,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Ontario' ],
      countryName: 'Canada'
    },
    searchScoreWithBoost: 110180008,
    searchScoreWithoutBoost: 110180003,
    accommodationCount: 5,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Maryland' ],
      countryName: 'United States'
    },
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179996,
    accommodationCount: 4,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge City',
      administrativeLevelNames: [ 'Indiana' ],
      countryName: 'United States'
    },
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179999,
    accommodationCount: 1,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'State of Tasmania' ],
      countryName: 'Commonwealth of Australia'
    },
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179999,
    accommodationCount: 1,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'England', 'Gloucestershire' ],
      countryName: 'United Kingdom of Great Britain and Northern Ireland'
    },
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179999,
    accommodationCount: 1,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Wisconsin' ],
      countryName: 'United States'
    },
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179999,
    accommodationCount: 1,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Vermont' ],
      countryName: 'United States'
    },
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179999,
    accommodationCount: 1,
    searchBoost: undefined
  }
]

Input: “cambridge”

{
  compound: {
    must: [
      {
        compound: {
          should: [
            {
              text: {
                path: 'type',
                query: 'COUNTRY',
                score: { constant: { value: 90000 } }
              }
            },
            {
              compound: {
                filter: [
                  { text: { path: 'type', query: 'POI' } },
                  { text: { path: 'poiType', query: 'ISLAND' } },
                  { equals: { path: 'hasGeometry', value: true } }
                ],
                score: { constant: { value: 80000 } }
              }
            },
            {
              compound: {
                filter: [
                  { text: { path: 'type', query: 'CITY' } },
                  { exists: { path: 'accommodationCount' } },
                  { range: { path: 'accommodationCount', gt: 0 } }
                ],
                score: { constant: { value: 70000 } }
              }
            },
            {
              text: {
                path: 'type',
                query: 'ADMINISTRATIVE_LEVEL',
                score: { constant: { value: 60000 } }
              }
            },
            {
              text: {
                path: 'type',
                query: 'CONTINENT',
                score: { constant: { value: 50000 } }
              }
            },
            {
              compound: {
                filter: [
                  { text: { path: 'type', query: 'POI' } },
                  {
                    compound: {
                      should: [
                        {
                          text: { path: 'poiType', query: 'ATTRACTION' }
                        },
                        {
                          text: { path: 'poiType', query: 'TRANSPORTATION' }
                        }
                      ],
                      minimumShouldMatch: 1
                    }
                  }
                ],
                score: { constant: { value: 40000 } }
              }
            },
            {
              compound: {
                filter: [ { text: { path: 'type', query: 'CITY' } } ],
                mustNot: [
                  { exists: { path: 'accommodationCount' } },
                  { range: { path: 'accommodationCount', gt: 0 } }
                ],
                score: { constant: { value: 30000 } }
              }
            },
            {
              compound: {
                filter: [ { text: { path: 'type', query: 'POI' } } ],
                mustNot: [
                  {
                    compound: {
                      should: [
                        {
                          compound: {
                            filter: [
                              {
                                text: { path: 'poiType', query: 'ISLAND' }
                              },
                              {
                                equals: { path: 'hasGeometry', value: true }
                              }
                            ]
                          }
                        },
                        {
                          text: { path: 'poiType', query: 'ATTRACTION' }
                        },
                        {
                          text: { path: 'poiType', query: 'TRANSPORTATION' }
                        }
                      ],
                      minimumShouldMatch: 1
                    }
                  }
                ],
                score: { constant: { value: 20000 } }
              }
            },
            {
              text: {
                path: 'type',
                query: 'CITY_DISTRICT',
                score: { constant: { value: 10000 } }
              }
            }
          ]
        }
      }
    ],
    filter: [
      {
        compound: {
          should: [
            { text: { path: 'type', query: 'POI' } },
            {
              compound: {
                should: [
                  { text: { path: 'type', query: 'COUNTRY' } },
                  {
                    text: { path: 'type', query: 'ADMINISTRATIVE_LEVEL' }
                  },
                  { text: { path: 'type', query: 'CITY' } }
                ],
                filter: [ { range: { path: 'accommodationCount', gt: 0 } } ],
                minimumShouldMatch: 1
              }
            }
          ],
          minimumShouldMatch: 1
        }
      }
    ],
    should: [
      {
        text: {
          query: 'cambridge',
          path: [
            { value: 'names', multi: 'keyword' },
            { value: 'alternateAndParentNames', multi: 'keyword' }
          ],
          score: { constant: { value: 2000000000 } }
        }
      },
      {
        wildcard: {
          query: 'cambridge*',
          allowAnalyzedField: true,
          path: [
            { value: 'names', multi: 'keyword' },
            { value: 'alternateAndParentNames', multi: 'keyword' }
          ],
          score: { constant: { value: 10000000 } }
        }
      },
      {
        text: {
          query: 'cambridge',
          path: [ { value: 'names' }, { value: 'alternateAndParentNames' } ],
          score: { constant: { value: 2000000 } }
        }
      },
      {
        wildcard: {
          query: 'cambridge*',
          allowAnalyzedField: true,
          path: [ { value: 'names' }, { value: 'alternateAndParentNames' } ],
          score: { constant: { value: 10000 } }
        }
      },
      {
        text: {
          query: 'cambridge',
          path: [ { value: 'names', multi: 'keyword' } ],
          score: { constant: { value: 20000000000 } }
        }
      },
      {
        wildcard: {
          query: 'cambridge*',
          allowAnalyzedField: true,
          path: [ { value: 'names', multi: 'keyword' } ],
          score: { constant: { value: 100000000 } }
        }
      },
      {
        text: {
          query: 'cambridge',
          path: [ { value: 'names' } ],
          score: { constant: { value: 20000000 } }
        }
      },
      {
        wildcard: {
          query: 'cambridge*',
          allowAnalyzedField: true,
          path: [ { value: 'names' } ],
          score: { constant: { value: 100000 } }
        }
      }
    ],
    minimumShouldMatch: 1,
    score: {
      function: {
        add: [
          { score: 'relevance' },
          { path: { value: 'accommodationCount', undefined: 0 } },
          { path: { value: 'searchBoost', undefined: 0 } }
        ]
      }
    }
  }
}

Gives output:

[
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Maryland' ],
      countryName: 'United States'
    },
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178940,
    accommodationCount: 4,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Waikato' ],
      countryName: 'New Zealand'
    },
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178881,
    accommodationCount: 63,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Massachusetts' ],
      countryName: 'United States'
    },
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178935,
    accommodationCount: 9,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'State of Tasmania' ],
      countryName: 'Commonwealth of Australia'
    },
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178943,
    accommodationCount: 1,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'England', 'Gloucestershire' ],
      countryName: 'United Kingdom of Great Britain and Northern Ireland'
    },
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178943,
    accommodationCount: 1,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Vermont' ],
      countryName: 'United States'
    },
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178943,
    accommodationCount: 1,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Wisconsin' ],
      countryName: 'United States'
    },
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178943,
    accommodationCount: 1,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Ontario' ],
      countryName: 'Canada'
    },
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178939,
    accommodationCount: 5,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'England', 'Cambridgeshire' ],
      countryName: 'United Kingdom of Great Britain and Northern Ireland'
    },
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178677,
    accommodationCount: 267,
    searchBoost: undefined
  },
  {
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Eastern Cape' ],
      countryName: 'South Africa'
    },
    searchScoreWithBoost: 22132150272,
    searchScoreWithoutBoost: 22132150272,
    accommodationCount: undefined,
    searchBoost: undefined
  }
]

The main difference is that “cambridge” is hitting exact keyword matches.

The problem is that “cambridg” is adding the function score (bottom of query, “score:”) to the score result and thus orders the results correctly. For “cambridge” it doensn’t do this and the scores are all the same (as shown by the searchScoreWithBoost property). I would have the same result with leaving out the function score.

So why does the function score not get applied in this case?

Hey @Ruud_van_Buul , it looks like the two queries you posted are the same. I am assuming that in the first query, all instances of “cambridge” should actually be “cambridg”, is that right?

I noticed that you are querying for “alternateAndParentNames” as well, but I don’t see it in the output. Can you share the output with this field included?

Yes you are correct, I seem to have copied the same thing twice. I don’t see an edit button so I wil list it here again with the data you asked. I also included the full aggregate in case that has any influence to the score somehow. I also only included one version of the query (“cambridge”, because that’s the faulty one), because the post becomes too long. The only difference is “cambridge” instead of “cambridg”

As you can see the result for “cambridge” still has the same searchScoreWithBoost result and thus does not apply the function score. In the “cambridg” example the function score doesn’t seem very consistent either.

[
  {
    '$search': {
      compound: {
        must: [
          {
            compound: {
              should: [
                {
                  text: {
                    path: 'type',
                    query: 'COUNTRY',
                    score: { constant: { value: 90000 } }
                  }
                },
                {
                  compound: {
                    filter: [
                      { text: { path: 'type', query: 'POI' } },
                      { text: { path: 'poiType', query: 'ISLAND' } },
                      { equals: { path: 'hasGeometry', value: true } }
                    ],
                    score: { constant: { value: 80000 } }
                  }
                },
                {
                  compound: {
                    filter: [
                      { text: { path: 'type', query: 'CITY' } },
                      { exists: { path: 'accommodationCount' } },
                      { range: { path: 'accommodationCount', gt: 0 } }
                    ],
                    score: { constant: { value: 70000 } }
                  }
                },
                {
                  text: {
                    path: 'type',
                    query: 'ADMINISTRATIVE_LEVEL',
                    score: { constant: { value: 60000 } }
                  }
                },
                {
                  text: {
                    path: 'type',
                    query: 'CONTINENT',
                    score: { constant: { value: 50000 } }
                  }
                },
                {
                  compound: {
                    filter: [
                      { text: { path: 'type', query: 'POI' } },
                      {
                        compound: {
                          should: [
                            {
                              text: { path: 'poiType', query: 'ATTRACTION' }
                            },
                            {
                              text: {
                                path: 'poiType',
                                query: 'TRANSPORTATION'
                              }
                            }
                          ],
                          minimumShouldMatch: 1
                        }
                      }
                    ],
                    score: { constant: { value: 40000 } }
                  }
                },
                {
                  compound: {
                    filter: [ { text: { path: 'type', query: 'CITY' } } ],
                    mustNot: [
                      { exists: { path: 'accommodationCount' } },
                      { range: { path: 'accommodationCount', gt: 0 } }
                    ],
                    score: { constant: { value: 30000 } }
                  }
                },
                {
                  compound: {
                    filter: [ { text: { path: 'type', query: 'POI' } } ],
                    mustNot: [
                      {
                        compound: {
                          should: [
                            {
                              compound: {
                                filter: [
                                  {
                                    text: {
                                      path: 'poiType',
                                      query: 'ISLAND'
                                    }
                                  },
                                  {
                                    equals: {
                                      path: 'hasGeometry',
                                      value: true
                                    }
                                  }
                                ]
                              }
                            },
                            {
                              text: { path: 'poiType', query: 'ATTRACTION' }
                            },
                            {
                              text: {
                                path: 'poiType',
                                query: 'TRANSPORTATION'
                              }
                            }
                          ],
                          minimumShouldMatch: 1
                        }
                      }
                    ],
                    score: { constant: { value: 20000 } }
                  }
                },
                {
                  text: {
                    path: 'type',
                    query: 'CITY_DISTRICT',
                    score: { constant: { value: 10000 } }
                  }
                }
              ]
            }
          }
        ],
        filter: [
          {
            compound: {
              should: [
                { text: { path: 'type', query: 'POI' } },
                {
                  compound: {
                    should: [
                      { text: { path: 'type', query: 'COUNTRY' } },
                      {
                        text: { path: 'type', query: 'ADMINISTRATIVE_LEVEL' }
                      },
                      { text: { path: 'type', query: 'CITY' } }
                    ],
                    filter: [
                      { range: { path: 'accommodationCount', gt: 0 } }
                    ],
                    minimumShouldMatch: 1
                  }
                }
              ],
              minimumShouldMatch: 1
            }
          }
        ],
        should: [
          {
            text: {
              query: 'cambridge',
              path: [
                { value: 'names', multi: 'keyword' },
                { value: 'alternateAndParentNames', multi: 'keyword' }
              ],
              score: { constant: { value: 2000000000 } }
            }
          },
          {
            wildcard: {
              query: 'cambridge*',
              allowAnalyzedField: true,
              path: [
                { value: 'names', multi: 'keyword' },
                { value: 'alternateAndParentNames', multi: 'keyword' }
              ],
              score: { constant: { value: 10000000 } }
            }
          },
          {
            text: {
              query: 'cambridge',
              path: [
                { value: 'names' },
                { value: 'alternateAndParentNames' }
              ],
              score: { constant: { value: 2000000 } }
            }
          },
          {
            wildcard: {
              query: 'cambridge*',
              allowAnalyzedField: true,
              path: [
                { value: 'names' },
                { value: 'alternateAndParentNames' }
              ],
              score: { constant: { value: 10000 } }
            }
          },
          {
            text: {
              query: 'cambridge',
              path: [ { value: 'names', multi: 'keyword' } ],
              score: { constant: { value: 20000000000 } }
            }
          },
          {
            wildcard: {
              query: 'cambridge*',
              allowAnalyzedField: true,
              path: [ { value: 'names', multi: 'keyword' } ],
              score: { constant: { value: 100000000 } }
            }
          },
          {
            text: {
              query: 'cambridge',
              path: [ { value: 'names' } ],
              score: { constant: { value: 20000000 } }
            }
          },
          {
            wildcard: {
              query: 'cambridge*',
              allowAnalyzedField: true,
              path: [ { value: 'names' } ],
              score: { constant: { value: 100000 } }
            }
          }
        ],
        minimumShouldMatch: 1,
        score: {
          function: {
            add: [
              { score: 'relevance' },
              { path: { value: 'accommodationCount', undefined: 0 } },
              { path: { value: 'searchBoost', undefined: 0 } }
            ]
          }
        }
      },
      tracking: { searchTerms: 'cambridge' },
      concurrent: true
    }
  },
  { '$limit': 10 },
  { '$addFields': { score: { '$meta': 'searchScore' } } },
  {
    '$setWindowFields': { output: { maxScore: { '$max': '$score' } } }
  },
  {
    '$addFields': {
      searchScoreWithBoost: '$score',
      searchScoreWithoutBoost: {
        '$subtract': [
          '$score',
          {
            '$add': [
              { '$ifNull': [ '$searchBoost', 0 ] },
              { '$ifNull': [ '$accommodationCount', 0 ] }
            ]
          }
        ]
      }
    }
  },
  {
    '$project': {
      id: 1,
      geonamesId: 1,
      name: 1,
      'highlightedName.value': 1,
      'highlightedName.type': 1,
      'highlightedName.__typename': 1,
      countryName: 1,
      administrativeLevelNames: 1,
      cityName: 1,
      type: 1,
      accommodationCount: 1,
      poiIcon: 1,
      poiType: 1,
      hasGeometry: 1,
      __typename: 1,
      i18n: 1,
      accommodationCountNl: 1,
      names: 1,
      alternateAndParentNames: 1,
      searchScoreWithBoost: 1,
      searchScoreWithoutBoost: 1,
      searchBoost: 1
    }
  }
]

“cambridg”

[
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'CBG',
      'Caergrawnt',
      'Cantabrigia',
      'Grantanbrycg',
      'Kambrij',
      'Kejmbridzh',
      'Kembric',
      'Kembridz',
      'Kembridza',
      'Kembridzas',
      'Kembridzh',
      'Kembridža',
      'Kembridžas',
      'Kembrigo',
      'Kembriĝo',
      'Kembrydzh',
      'Kempritz',
      'Kiam-khiau',
      'Kiam-khiâu',
      'jian qiao',
      'kambrydj',
      'keimbeuliji',
      'kembridj',
      'kembrij',
      'kembrija',
      'kenburijji',
      'khem bridc',
      'kmbryj',
      'kyamabrija',
      'kymbrj',
      "qyymbrydg'",
      'Κέμπριτζ',
      'Кеймбридж',
      'Кембридж',
      'Кембриџ',
      'Кембриҷ',
      'Кембрыдж',
      'Кембрідж',
      'Քեմբրիջ',
      "קיימברידג'",
      'كامبريدج',
      'کمبریج',
      'کیمبرج',
      'केंब्रिज',
      'ক্যামব্রিজ',
      'ಕೇಂಬ್ರಿಜ್',
      'കേംബ്രിഡ്ജ്',
      'เคมบริดจ์',
      'ကိန်းဘရစ်ချ်မြို့',
      'კემბრიჯი',
      'ケンブリッジ',
      '劍橋',
      '케임브리지',
      'England',
      'Cambridgeshire',
      'United Kingdom of Great Britain and Northern Ireland',
      'United Kingdom',
      'Verenigd Koninkrijk',
      'Vereinigtes Königreich',
      'Royaume-Uni',
      'Reino Unido',
      'Regno Unito'
    ],
    accommodationCount: 268,
    searchScoreWithBoost: 110180272,
    searchScoreWithoutBoost: 110180004,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'England', 'Cambridgeshire' ],
      countryName: 'United Kingdom of Great Britain and Northern Ireland'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Cambridge pa New Zealand',
      'Cambridge på New Zealand',
      'Kejmbridzh',
      'Кеймбридж',
      'کیمبرج، نیوزی لینڈ',
      'Waikato',
      'New Zealand',
      'Nieuw-Zeeland',
      'Neuseeland',
      'Nouvelle-Zélande',
      'Nueva Zelanda',
      'Nuova Zelanda'
    ],
    accommodationCount: 63,
    searchScoreWithBoost: 110180064,
    searchScoreWithoutBoost: 110180001,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Waikato' ],
      countryName: 'New Zealand'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Cambridge i Massachusetts',
      'Cantabrigia',
      'Kehmbridzh',
      'Keimbridza',
      'Keimbridža',
      'Keimpritz',
      'Kejmbridzh',
      'Kembridz',
      'Kembridzas',
      'Kembridzh',
      'Kembridžas',
      'Kembrigo',
      'Kembrizh',
      'Kembriĝo',
      'Kembrydzh',
      'Mishawum',
      'New Town',
      'New Towne',
      'Newtown',
      'Newtowne',
      'Old Cambridge',
      'jian qiao',
      'kambrydj',
      'keimbeuliji',
      'kembrija',
      'kempirij',
      'kenburijji',
      'khem bridc',
      'kmbryj  masachwst',
      'qyymbrydg',
      'Κέιμπριτζ',
      'Кеймбридж',
      'Кембридж',
      'Кембриж',
      'Кембриџ',
      'Кембриҷ',
      'Кембрыдж',
      'Кэмбридж',
      'Քեմբրիջ',
      'קיימברידג',
      'קעמברידזש',
      'كامبريدج',
      'کمبریج، ماساچوست',
      'کیمبرج، میساچوسٹس',
      'केंब्रिज',
      'கேம்பிரிஜ்',
      'เคมบริดจ์',
      'ケンブリッジ',
      '剑桥',
      '케임브리지',
      'Massachusetts',
      'United States',
      'Verenigde Staten',
      'Vereinigte Staaten',
      'États Unis',
      'Estados Unidos',
      'Stati Uniti'
    ],
    accommodationCount: 9,
    searchScoreWithBoost: 110180008,
    searchScoreWithoutBoost: 110179999,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Massachusetts' ],
      countryName: 'United States'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Kejmbridzh',   'Kembridz',
      'Kembridzh',    'Kembrigo',
      'Kembriĝo',     'jian qiao',
      'kambrydj',     'keimbeuliji',
      'kenburijji',   'kmbryj  antaryw',
      'kymbrj',       'Кеймбридж',
      'Кембридж',     'Кембриџ',
      'كامبريدج',     'کمبریج، انتاریو',
      'کیمبرج',       'کیمبرج، انٹاریو',
      'ケンブリッジ', '剑桥',
      '케임브리지',   'Ontario',
      'Canada',       'Kanada',
      'Canadá'
    ],
    accommodationCount: 5,
    searchScoreWithBoost: 110180008,
    searchScoreWithoutBoost: 110180003,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Ontario' ],
      countryName: 'Canada'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'CGE',               'Kehmbridzh',
      'Kembridz',          'Kembridzh',
      'jian qiao',         'kambrydj',
      'kenburijji',        'kymbryj  mrylnd',
      'Кембридж',          'Кембриџ',
      'Кэмбридж',          'كامبريدج',
      'کیمبرج، میری لینڈ', 'کیمبریج، مریلند',
      'ケンブリッジ',      '劍橋',
      'Maryland',          'United States',
      'Verenigde Staten',  'Vereinigte Staaten',
      'États Unis',        'Estados Unidos',
      'Stati Uniti'
    ],
    accommodationCount: 4,
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179996,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Maryland' ],
      countryName: 'United States'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'England',
      'Gloucestershire',
      'United Kingdom of Great Britain and Northern Ireland',
      'United Kingdom',
      'Verenigd Koninkrijk',
      'Vereinigtes Königreich',
      'Royaume-Uni',
      'Reino Unido',
      'Regno Unito'
    ],
    accommodationCount: 1,
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179999,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'England', 'Gloucestershire' ],
      countryName: 'United Kingdom of Great Britain and Northern Ireland'
    }
  },
  {
    names: [ 'Cambridge City' ],
    alternateAndParentNames: [
      'Indiana',
      'United States',
      'Verenigde Staten',
      'Vereinigte Staaten',
      'États Unis',
      'Estados Unidos',
      'Stati Uniti'
    ],
    accommodationCount: 1,
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179999,
    i18n: {
      name: 'Cambridge City',
      administrativeLevelNames: [ 'Indiana' ],
      countryName: 'United States'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Cambridge Borough',  'Cambridge Village',
      'Kembridz',           'Kembridzh',
      'kambrydj',           'Кембридж',
      'Кембриџ',            'كامبريدج',
      'کیمبرج، ورمونٹ',     'Vermont',
      'United States',      'Verenigde Staten',
      'Vereinigte Staaten', 'États Unis',
      'Estados Unidos',     'Stati Uniti'
    ],
    accommodationCount: 1,
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179999,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Vermont' ],
      countryName: 'United States'
    }
  },
  {
    names: [ 'Cambridge Springs' ],
    alternateAndParentNames: [
      'Cambridge',
      'Cambridgeboro',
      'Cambridgeborough',
      'Kejmbridz Springs',
      'Кејмбриџ Спрингс',
      'Pennsylvania',
      'United States',
      'Verenigde Staten',
      'Pennsylvanien',
      'Vereinigte Staaten',
      'Pennsylvanie',
      'États Unis',
      'Pensilvania',
      'Estados Unidos',
      'Stati Uniti'
    ],
    accommodationCount: 3,
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179997,
    i18n: {
      name: 'Cambridge Springs',
      administrativeLevelNames: [ 'Pennsylvania' ],
      countryName: 'United States'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'State of Tasmania',
      'Commonwealth of Australia',
      'Tasmania',
      'Australia',
      'Australië',
      'Australien',
      'Tasmanie',
      'Australie'
    ],
    accommodationCount: 1,
    searchScoreWithBoost: 110180000,
    searchScoreWithoutBoost: 110179999,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'State of Tasmania' ],
      countryName: 'Commonwealth of Australia'
    }
  }
]

“cambridge”:

[
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Cambridge i Massachusetts',
      'Cantabrigia',
      'Kehmbridzh',
      'Keimbridza',
      'Keimbridža',
      'Keimpritz',
      'Kejmbridzh',
      'Kembridz',
      'Kembridzas',
      'Kembridzh',
      'Kembridžas',
      'Kembrigo',
      'Kembrizh',
      'Kembriĝo',
      'Kembrydzh',
      'Mishawum',
      'New Town',
      'New Towne',
      'Newtown',
      'Newtowne',
      'Old Cambridge',
      'jian qiao',
      'kambrydj',
      'keimbeuliji',
      'kembrija',
      'kempirij',
      'kenburijji',
      'khem bridc',
      'kmbryj  masachwst',
      'qyymbrydg',
      'Κέιμπριτζ',
      'Кеймбридж',
      'Кембридж',
      'Кембриж',
      'Кембриџ',
      'Кембриҷ',
      'Кембрыдж',
      'Кэмбридж',
      'Քեմբրիջ',
      'קיימברידג',
      'קעמברידזש',
      'كامبريدج',
      'کمبریج، ماساچوست',
      'کیمبرج، میساچوسٹس',
      'केंब्रिज',
      'கேம்பிரிஜ்',
      'เคมบริดจ์',
      'ケンブリッジ',
      '剑桥',
      '케임브리지',
      'Massachusetts',
      'United States',
      'Verenigde Staten',
      'Vereinigte Staaten',
      'États Unis',
      'Estados Unidos',
      'Stati Uniti'
    ],
    accommodationCount: 9,
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178935,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Massachusetts' ],
      countryName: 'United States'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'CGE',               'Kehmbridzh',
      'Kembridz',          'Kembridzh',
      'jian qiao',         'kambrydj',
      'kenburijji',        'kymbryj  mrylnd',
      'Кембридж',          'Кембриџ',
      'Кэмбридж',          'كامبريدج',
      'کیمبرج، میری لینڈ', 'کیمبریج، مریلند',
      'ケンブリッジ',      '劍橋',
      'Maryland',          'United States',
      'Verenigde Staten',  'Vereinigte Staaten',
      'États Unis',        'Estados Unidos',
      'Stati Uniti'
    ],
    accommodationCount: 4,
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178940,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Maryland' ],
      countryName: 'United States'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Cambridge pa New Zealand',
      'Cambridge på New Zealand',
      'Kejmbridzh',
      'Кеймбридж',
      'کیمبرج، نیوزی لینڈ',
      'Waikato',
      'New Zealand',
      'Nieuw-Zeeland',
      'Neuseeland',
      'Nouvelle-Zélande',
      'Nueva Zelanda',
      'Nuova Zelanda'
    ],
    accommodationCount: 63,
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178881,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Waikato' ],
      countryName: 'New Zealand'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'England',
      'Gloucestershire',
      'United Kingdom of Great Britain and Northern Ireland',
      'United Kingdom',
      'Verenigd Koninkrijk',
      'Vereinigtes Königreich',
      'Royaume-Uni',
      'Reino Unido',
      'Regno Unito'
    ],
    accommodationCount: 1,
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178943,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'England', 'Gloucestershire' ],
      countryName: 'United Kingdom of Great Britain and Northern Ireland'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Cambridge Borough',  'Cambridge Village',
      'Kembridz',           'Kembridzh',
      'kambrydj',           'Кембридж',
      'Кембриџ',            'كامبريدج',
      'کیمبرج، ورمونٹ',     'Vermont',
      'United States',      'Verenigde Staten',
      'Vereinigte Staaten', 'États Unis',
      'Estados Unidos',     'Stati Uniti'
    ],
    accommodationCount: 1,
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178943,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Vermont' ],
      countryName: 'United States'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'State of Tasmania',
      'Commonwealth of Australia',
      'Tasmania',
      'Australia',
      'Australië',
      'Australien',
      'Tasmanie',
      'Australie'
    ],
    accommodationCount: 1,
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178943,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'State of Tasmania' ],
      countryName: 'Commonwealth of Australia'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Kembridzh',
      'Кембридж',
      'Wisconsin',
      'United States',
      'Verenigde Staten',
      'Vereinigte Staaten',
      'États Unis',
      'Estados Unidos',
      'Stati Uniti'
    ],
    accommodationCount: 1,
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178943,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Wisconsin' ],
      countryName: 'United States'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Kejmbridzh',   'Kembridz',
      'Kembridzh',    'Kembrigo',
      'Kembriĝo',     'jian qiao',
      'kambrydj',     'keimbeuliji',
      'kenburijji',   'kmbryj  antaryw',
      'kymbrj',       'Кеймбридж',
      'Кембридж',     'Кембриџ',
      'كامبريدج',     'کمبریج، انتاریو',
      'کیمبرج',       'کیمبرج، انٹاریو',
      'ケンブリッジ', '剑桥',
      '케임브리지',   'Ontario',
      'Canada',       'Kanada',
      'Canadá'
    ],
    accommodationCount: 5,
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178939,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Ontario' ],
      countryName: 'Canada'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'CBG',
      'Caergrawnt',
      'Cantabrigia',
      'Grantanbrycg',
      'Kambrij',
      'Kejmbridzh',
      'Kembric',
      'Kembridz',
      'Kembridza',
      'Kembridzas',
      'Kembridzh',
      'Kembridža',
      'Kembridžas',
      'Kembrigo',
      'Kembriĝo',
      'Kembrydzh',
      'Kempritz',
      'Kiam-khiau',
      'Kiam-khiâu',
      'jian qiao',
      'kambrydj',
      'keimbeuliji',
      'kembridj',
      'kembrij',
      'kembrija',
      'kenburijji',
      'khem bridc',
      'kmbryj',
      'kyamabrija',
      'kymbrj',
      "qyymbrydg'",
      'Κέμπριτζ',
      'Кеймбридж',
      'Кембридж',
      'Кембриџ',
      'Кембриҷ',
      'Кембрыдж',
      'Кембрідж',
      'Քեմբրիջ',
      "קיימברידג'",
      'كامبريدج',
      'کمبریج',
      'کیمبرج',
      'केंब्रिज',
      'ক্যামব্রিজ',
      'ಕೇಂಬ್ರಿಜ್',
      'കേംബ്രിഡ്ജ്',
      'เคมบริดจ์',
      'ကိန်းဘရစ်ချ်မြို့',
      'კემბრიჯი',
      'ケンブリッジ',
      '劍橋',
      '케임브리지',
      'England',
      'Cambridgeshire',
      'United Kingdom of Great Britain and Northern Ireland',
      'United Kingdom',
      'Verenigd Koninkrijk',
      'Vereinigtes Königreich',
      'Royaume-Uni',
      'Reino Unido',
      'Regno Unito'
    ],
    accommodationCount: 268,
    searchScoreWithBoost: 22132178944,
    searchScoreWithoutBoost: 22132178676,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'England', 'Cambridgeshire' ],
      countryName: 'United Kingdom of Great Britain and Northern Ireland'
    }
  },
  {
    names: [ 'Cambridge' ],
    alternateAndParentNames: [
      'Eastern Cape',
      'South Africa',
      'Province of Eastern Cape',
      'Republic of South Africa',
      'Oost-Kaap',
      'Zuid-Afrika',
      'Ostkap',
      'Südafrika',
      'Cap oriental',
      'Afrique du Sud',
      'Provincia Oriental del Cabo',
      'Sudáfrica',
      'Provincia del Capo Orientale',
      'Sudafrica'
    ],
    searchScoreWithBoost: 22132150272,
    searchScoreWithoutBoost: 22132150272,
    i18n: {
      name: 'Cambridge',
      administrativeLevelNames: [ 'Eastern Cape' ],
      countryName: 'South Africa'
    }
  }
]

Hi @amyjian, did you have a chacne to look at this again?