Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Places: PlaceAutocompleteType is missing values #877

Open
michael-ameri opened this issue Nov 23, 2022 · 4 comments
Open

Places: PlaceAutocompleteType is missing values #877

michael-ameri opened this issue Nov 23, 2022 · 4 comments
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@michael-ameri
Copy link

Environment details

Library version: 2.1.2

Code example

PlacesApi.placeAutocomplete(someContext, "Zurich", new PlaceAutocompleteRequest.SessionToken())
            .types(PlaceAutocompleteType.ESTABLISHMENT)

2 issues:

  1. The PlaceAutocompleteType enum only covers a small subset of available types according to https://developers.google.com/maps/documentation/places/web-service/supported_types#table2
  2. There is no way to use multiple types, which is possible via REST calls.
@michael-ameri michael-ameri added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Nov 23, 2022
@n10v
Copy link

n10v commented Aug 14, 2023

  1. The PlaceAutocompleteType enum only covers a small subset of available types according to https://developers.google.com/maps/documentation/places/web-service/supported_types#table2

Found workaround with .custom method:

PlacesApi.placeAutocomplete(someContext, "Zurich", new PlaceAutocompleteRequest.SessionToken())
            .custom("types", "route")
  1. There is no way to use multiple types, which is possible via REST calls.

You can chain calls to have multiple types:

PlacesApi.placeAutocomplete(someContext, "Zurich", new PlaceAutocompleteRequest.SessionToken())
            .types(PlaceAutocompleteType.ESTABLISHMENT)
            .types(PlaceAutocompleteType.ADDRESS)  

@n10v
Copy link

n10v commented Aug 15, 2023

Actually I just tried to chain calls and the last value overwrites the first one :(

@marcoserafini2
Copy link

marcoserafini2 commented Jul 23, 2024

  1. In an Autocomplete request, it is possible to filter by at most one element of the types contained in the enum PlaceAutocompleteType. This is correct https://developers.google.com/maps/documentation/places/web-service/autocomplete?hl=it#types

  2. What should be added is the possibility to filter an autocomplete request with multiple types that are not part of the enum PlaceAutocompleteType.

For example, we could introduce on PlaceAutoCompleteRequest:

 /**
   * Restricts the results to places matching the specified types
   *
   * @param types The {@link PlaceType}s to restrict results to.
   * @return Returns this {@code PlaceAutocompleteRequest} for call chaining.
   */
  public PlaceAutocompleteRequest types(PlaceType... types) {
    return param("types", join('|',  types));
  }

What do you think @n10v ?

@n10v
Copy link

n10v commented Jul 23, 2024

  1. The link is leading to the following URL, which shows 0 issues for me (probably the issues are private): https://github.com/googlemaps/google-maps-services-java/issues/url
  2. Makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants