{"id":16906405,"url":"https://github.com/chrisru/match-sort","last_synced_at":"2025-08-20T04:03:28.788Z","repository":{"id":127152009,"uuid":"119586701","full_name":"ChrisRu/match-sort","owner":"ChrisRu","description":"🔍 Deterministic array search","archived":false,"fork":false,"pushed_at":"2018-01-31T13:35:47.000Z","size":7,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T15:30:14.676Z","etag":null,"topics":["deterministic","go","golang","match-sort","match-sorter","search"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChrisRu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-30T19:53:59.000Z","updated_at":"2018-06-24T12:48:53.000Z","dependencies_parsed_at":"2023-04-19T16:28:45.841Z","dependency_job_id":null,"html_url":"https://github.com/ChrisRu/match-sort","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisRu%2Fmatch-sort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisRu%2Fmatch-sort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisRu%2Fmatch-sort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisRu%2Fmatch-sort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChrisRu","download_url":"https://codeload.github.com/ChrisRu/match-sort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244650040,"owners_count":20487545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deterministic","go","golang","match-sort","match-sorter","search"],"created_at":"2024-10-13T18:42:30.869Z","updated_at":"2025-03-20T16:33:15.836Z","avatar_url":"https://github.com/ChrisRu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003ematch-sorter\u003c/h1\u003e\n\n  \u003cp\u003eSimple, expected, and deterministic best-match sorting of an array in Go Lang\u003c/p\u003e\n\u003c/div\u003e\n\n## The problem\n\n1. You have a list of dozens, hundreds, or thousands of items\n2. You want to filter and sort those items intelligently (maybe you have a filter input for the user)\n3. You want simple, expected, and deterministic sorting of the items (no fancy math algorithm that fancily changes the sorting as they type)\n\n## This solution\n\nThis follows a simple and sensible (user friendly) algorithm that makes it easy for you to filter and sort a list of items based on given input. Items are ranked based on sensible criteria that result in a better user experience.\n\nTo explain the ranking system, I'll use countries as an example:\n\n1. **CASE SENSITIVE EQUALS**: Case-sensitive equality trumps all. These will be first. (ex. `France` would match `France `, but not `france`)\n2. **EQUALS**: Case-insensitive equality (ex. `France` would match `france`)\n3. **STARTS WITH**: If the item starts with the given value (ex. `Sou` would match `South Korea` or `South Africa`)\n4. **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`)\n5. **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`)\n6. **CASE ACRONYM** If the item's case matches the synonym (ex. `uk` would match `united-kingdom` or `UnitedKingdom`)\n7. **CONTAINS**: If the item contains the given value (ex. `ham` would match `Bahamas`)\n8. **ACRONYM**: If the item's acronym is the given value (ex. `us` would match `United States`)\n9. **SIMPLE MATCH**: If the item has letters in the same order as the letters of the given value (ex. `iw` would match `Zimbabwe`, but not `Kuwait` because it must be in the same order). Furthermore, if the item is a closer match, it will rank higher (ex. `ua` matches `Uruguay` more closely than `United States of America`, therefore `Uruguay` will be ordered before `United States of America`)\n\nThis ranking seems to make sense in people's minds. At least it does in mine. Feedback welcome!\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisru%2Fmatch-sort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisru%2Fmatch-sort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisru%2Fmatch-sort/lists"}