Skip to content

Instantly share code, notes, and snippets.

@jamesplease
Last active April 10, 2018 17:06
Show Gist options
  • Save jamesplease/7c0d7c609a1bfa8670d55f2335ed2bcd to your computer and use it in GitHub Desktop.
Save jamesplease/7c0d7c609a1bfa8670d55f2335ed2bcd to your computer and use it in GitHub Desktop.
  1. CASE SENSITIVE EQUALS: Case-sensitive equality trumps all. These will be first. (ex. France would match France, but not france)
  2. EQUALS: Case-insensitive equality (ex. France would match france)
  3. STARTS WITH: If the item starts with the given value (ex. Sou would match South Korea or South Africa)
  4. WORD STARTS WITH: If the item has multiple words, then if one of those words starts with the given value (ex. Repub would match Dominican Republic)
  5. CASE STARTS WITH: If the item has a defined case (camelCase, PascalCase, snake_case or kebab-case), then if one of the parts starts with the given value (ex. kingdom would match unitedKingdom or united_kingdom)
  6. CASE ACRONYM If the item's case matches the synonym (ex. uk would match united-kingdom or UnitedKingdom)
  7. CONTAINS: If the item contains the given word (ex. America would match South America)
  8. ACRONYM: If the item's acronym is the given value (ex. us would match United States)

Notes

  • Searching for "rica" would not bring up "America"
  • The first 4 are particularly important
  • Casing is not particularly important most of the time

Special Searches

  • Different use cases may require additional algorithms. For instance, to handle aliases or unique identifiers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment