Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • R Rest Countries
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • restcountries
  • Rest Countries
  • Issues
  • #160
Closed
Open
Issue created Sep 28, 2022 by Franweb79@Franweb79

Version 3.1 problem with partial country searches

Hi, I am developing a little app for learning purposes. We want to show suggestions based on partial country name. For example I understand if I search "ho", I should get results like "Hong Kong, Honduras..." countries which contains "ho" string.

But, why do I get such strange results like Japan?

For example, in postman:

https://restcountries.com/v3.1/name/ho?fields=name

I get such response. Why do I get countries like Noth Korea or Japan or such with no "ho" on none of their names? Maybe is looking on all the fields for the string, and not only in the name field? Can´t get it.

[
    {
        "name": {
            "common": "Hong Kong",
            "official": "Hong Kong Special Administrative Region of the People's Republic of China",
            "nativeName": {
                "eng": {
                    "official": "Hong Kong Special Administrative Region of the People's Republic of China",
                    "common": "Hong Kong"
                },
                "zho": {
                    "official": "中华人民共和国香港特别行政区",
                    "common": "香港"
                }
            }
        }
    },
    {
        "name": {
            "common": "North Korea",
            "official": "Democratic People's Republic of Korea",
            "nativeName": {
                "kor": {
                    "official": "조선민주주의인민공화국",
                    "common": "조선"
                }
            }
        }
    },
    {
        "name": {
            "common": "Japan",
            "official": "Japan",
            "nativeName": {
                "jpn": {
                    "official": "日本",
                    "common": "日本"
                }
            }
        }
    },
    {
        "name": {
            "common": "Maldives",
            "official": "Republic of the Maldives",
            "nativeName": {
                "div": {
                    "official": "ދިވެހިރާއްޖޭގެ ޖުމްހޫރިއްޔާ",
                    "common": "ދިވެހިރާއްޖޭގެ"
                }
            }
        }
    },
    {
        "name": {
            "common": "Vatican City",
            "official": "Vatican City State",
            "nativeName": {
                "ita": {
                    "official": "Stato della Città del Vaticano",
                    "common": "Vaticano"
                },
                "lat": {
                    "official": "Status Civitatis Vaticanæ",
                    "common": "Vaticanæ"
                }
            }
        }
    },
    {
        "name": {
            "common": "Lesotho",
            "official": "Kingdom of Lesotho",
            "nativeName": {
                "eng": {
                    "official": "Kingdom of Lesotho",
                    "common": "Lesotho"
                },
                "sot": {
                    "official": "Kingdom of Lesotho",
                    "common": "Lesotho"
                }
            }
        }
    },
    {
        "name": {
            "common": "China",
            "official": "People's Republic of China",
            "nativeName": {
                "zho": {
                    "official": "中华人民共和国",
                    "common": "中国"
                }
            }
        }
    },
    {
        "name": {
            "common": "Honduras",
            "official": "Republic of Honduras",
            "nativeName": {
                "spa": {
                    "official": "República de Honduras",
                    "common": "Honduras"
                }
            }
        }
    },
    {
        "name": {
            "common": "Netherlands",
            "official": "Kingdom of the Netherlands",
            "nativeName": {
                "nld": {
                    "official": "Koninkrijk der Nederlanden",
                    "common": "Nederland"
                }
            }
        }
    }
]
Edited Sep 28, 2022 by Franweb79
Assignee
Assign to
Time tracking