javascript 谷歌地图地方自动完成搜索任何位置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27999050/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 08:16:42  来源:igfitidea点击:

Google Maps Places Autocomplete search any position

javascriptgoogle-mapsautocompletemapsgoogle-places-api

提问by Misha Akopov

When I use google places autocomplete api and as search places with keyword

当我使用 google 地方自动完成 api 并作为带有关键字的搜索位置时

&input=MyWord

&input=MyWord

result is places that start with MyWord. e.g. MyWord1 , MyWord2, MyWordblalba I want to get results that contain MyWord in middle or at any position of result. e.g. blablaMyWordbla

结果是以 MyWord 开头的地方。例如 MyWord1 , MyWord2 , MyWordblalba 我想获得在结果的中间或任何位置包含 MyWord 的结果。例如blabla MyWordbla

Is it possible ? I can't find any parameter or wildcard in documentation

是否可以 ?我在文档中找不到任何参数或通配符

https://developers.google.com/maps/documentation/javascript/places-autocomplete

https://developers.google.com/maps/documentation/javascript/places-autocomplete

采纳答案by Misha Akopov

As far as I know there is not such functionality to search locations by wildcards, you can only search by beginning of the word

据我所知,没有通过通配符搜索位置的功能,您只能通过单词的开头进行搜索

回答by plexer

I suggest using the Search functionality of the API, rather than Autocomplete. Autocomplete is designed to complete place names typed by an end-user and therefore focuses on generating suggestions for suffixes.

我建议使用 API 的搜索功能,而不是自动完成。自动完成旨在完成最终用户键入的地名,因此专注于生成后缀建议。