小编Rob*_*cia的帖子

Google Geocoder缺少类型地址组件

我现在对谷歌地理编码器感到难过.现在,如果我按地址查询"纽约市纽约市",我会得到结果,说结果的类型是"类型":["locality","political"]但是address_components中没有地点.如果我查询"坦佩,亚利桑那州",同样的事情.如果我搜索某个州,则类型为administrative_area_level_1,但它只给我address_compenents中的国家/地区.有任何想法吗?

var geocoder = new google.maps.Geocoder();
geocoder.geocode({'address': "New York City, NY"}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
         //do stuff
    } else {
        console.log("Geocode was not successful for the following reason: " + status);
    }
Run Code Online (Sandbox Code Playgroud)

我的结果为"纽约市,纽约"

[{"address_components":[{"long_name":"New York","short_name":"NY","types":["administrative_area_level_1","political"]},{"long_name":"United States","short_name":"US","types":["country","political"]}],"formatted_address":"New York, USA","geometry":{"bounds":{"south":40.4773991,"west":-74.25908989999999,"north":40.9175771,"east":-73.7002721},"location":{"lat":40.7127837,"lng":-74.00594130000002},"location_type":"APPROXIMATE","viewport":{"south":40.4960439,"west":-74.2557349,"north":40.9152555,"east":-73.7002721}},"place_id":"ChIJOwg_06VPwokRYv534QaPC8g","types":["locality","political"]}]
Run Code Online (Sandbox Code Playgroud)

我很困惑,为什么它告诉我它是类型城市(地方),但缺少locality属性.我希望地方在那里有值,"纽约"和格式化的地址,以包括其中的位置.谢谢!

google-maps geocoding geolocation google-maps-api-3

4
推荐指数
1
解决办法
1165
查看次数

Elasticsearch 不会匹配确切的字符串

我创建了一个带有完成提示的类别索引,但它的行为并不符合我的预期。

curl -XPUT http://localhost:9200/categories/category/_mapping -d '{
    "category" : {
        "properties" : {
            "categoryDescription" : {
                "type" : "string"
            },
            "suggest" : {
                "type" : "completion",
                "analyzer" : "simple",
                "search_analyzer" : "simple",
                "payloads" : true
            }
        }
    }
}'
Run Code Online (Sandbox Code Playgroud)

我有一个为“墨西哥杂货店”编入索引的类别,当我搜索该字符串时,我得到的点击次数为零,只有一个建议结果:

{
    "query":{
        "fuzzy":{
            "categoryDescription":{
                "value":"mexican grocery store"
            }
        }
    },
    "from":0,
    "size":20,
    "suggest":{
        "category-suggest":{
            "text":"mexican grocery store",
            "completion":{
                "field":"suggest","fuzzy":{"fuzziness":2}
            }
        }
    }
}

{
    "took":19,
    "timed_out":false,
    "_shards":{"total":5,"successful":5,"failed":0},
    "hits":{
        "total":0,"max_score":null,"hits":[]
    },
    "suggest":{
        "category-suggest":[
            {
                "text":"mexican grocery store",
                "offset":0,
                "length":21,
                "options":[
                    {
                        "text":"Mexican …
Run Code Online (Sandbox Code Playgroud)

autosuggest elasticsearch

2
推荐指数
1
解决办法
868
查看次数