Google api Place Autocomplete API返回带有不正确匹配子字符串的预测

Google api Place Autocomplete API返回带有不正确匹配子字符串的预测,google-api,google-places-api,google-places,Google Api,Google Places Api,Google Places,我正在进行以下查询(keyparam省略): 在我得到的结果中,第一个预测是: { "description" : "Clinton, New York, NY, United States", "id" : "e5c6298aafa5b208354b16aecd163ac85eda40ae", "matched_substrings" : [ { "length" : 7, "offset" : 0

我正在进行以下查询(
key
param省略):

在我得到的结果中,第一个预测是:

  {
     "description" : "Clinton, New York, NY, United States",
     "id" : "e5c6298aafa5b208354b16aecd163ac85eda40ae",
     "matched_substrings" : [
        {
           "length" : 7,
           "offset" : 0
        }
     ],
     "place_id" : "ChIJUWBgpFBYwokRAprvYGCydhk",
     "reference" : "CkQ8AAAAKW4NgbXbTCXL8MuOOUohazn6TzvRlt8eurqW4QPFCMQXDZDP7nUQXT3c2rb4BYTcIc6fdZH2sQOj-MdNifcsZhIQFK85n69ce3b1Ec93MNxpBBoU4O778Tm2b8-tHTyCiUAZmh00QBI",
     "structured_formatting" : {
        "main_text" : "Clinton",
        "main_text_matched_substrings" : [
           {
              "length" : 7,
              "offset" : 0
           }
        ],
        "secondary_text" : "New York, NY, United States"
     },
     "terms" : [
        {
           "offset" : 0,
           "value" : "Clinton"
        },
        {
           "offset" : 9,
           "value" : "New York"
        },
        {
           "offset" : 19,
           "value" : "NY"
        },
        {
           "offset" : 23,
           "value" : "United States"
        }
     ],
     "types" : [ "neighborhood", "political", "geocode" ]
  },
您会注意到“Clinton”没有出现在我的输入字符串中。这个结果来自哪里?为什么我会得到它?
匹配的子字符串

包含具有偏移值和长度的数组。这些描述了输入的术语在预测结果文本中的位置,因此,如果需要,可以突出显示术语


这里的情况显然不是这样。

您一定是搞错了什么,您的请求实际上并没有返回这些预测,它返回了两个与您的输入匹配的地理代码:

"predictions" : [
   {
      "description" : "Helloo Creek, Halls Creek, New South Wales, Australia",
      "matched_substrings" : [
         {
            "length" : 6,
            "offset" : 0
         }
      ],
      "place_id" : "ChIJWVba98sSoGsRZDAiQHlxv6I",
      ...
  },
  {
      "description" : "Helloop, Achtmaal, Netherlands",
      "id" : "5f9eb5caffb95c218e8c9ef002aabf7ae85d597e",
      "matched_substrings" : [
         {
            "length" : 6,
            "offset" : 0
         }
      ],
      "place_id" : "ChIJQdEGANsaxEcRUJeH7LZlmBk",
      ...

如果您再次遇到类似问题,请提交一个bug。

感谢您尝试重现。我没有弄糟任何事情:上面的URL与我最初的请求相同(除了它不包括我的
),而响应就是我在问题中粘贴的内容。我现在得到了和你一样的回答。看来已经修好了。感谢问题跟踪链接。
"predictions" : [
   {
      "description" : "Helloo Creek, Halls Creek, New South Wales, Australia",
      "matched_substrings" : [
         {
            "length" : 6,
            "offset" : 0
         }
      ],
      "place_id" : "ChIJWVba98sSoGsRZDAiQHlxv6I",
      ...
  },
  {
      "description" : "Helloop, Achtmaal, Netherlands",
      "id" : "5f9eb5caffb95c218e8c9ef002aabf7ae85d597e",
      "matched_substrings" : [
         {
            "length" : 6,
            "offset" : 0
         }
      ],
      "place_id" : "ChIJQdEGANsaxEcRUJeH7LZlmBk",
      ...