Skip to content

Commit

Permalink
enhance(algolia): sort dashed entities to the top of `availableEntity…
Browse files Browse the repository at this point in the history
…Names` array
  • Loading branch information
marcelgerber committed Apr 16, 2024
1 parent c10330d commit b164ac0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion baker/algolia/indexChartsToAlgolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const processAvailableEntities = (availableEntities: string[] | null) => {
// if "USA" is within the first 100-or-so entries of the array.
// So, the easy solution is to sort the entities to ensure that countries
// with variant names are at the top.
// Also, entities containing a hyphen like "low-income countries" can also
// only be found if they're within the first 100-or-so entries.
// - @marcelgerber, 2024-03-25
return orderBy(
availableEntities,
Expand All @@ -46,9 +48,10 @@ const processAvailableEntities = (availableEntities: string[] | null) => {
countriesWithVariantNames.has(
removeTrailingParenthetical(entityName)
),
(entityName) => entityName.includes("-"),
(entityName) => entityName,
],
["desc", "asc"]
["desc", "desc", "asc"]
)
}

Expand Down

0 comments on commit b164ac0

Please sign in to comment.