Ispas Claudiu
Ispas Claudiu

Reputation: 2008

How does the Google Place API request query work with multiple types?

I have a problem with the google query. I want to search for, let's say nearby dentist cabinets. Almost all cabinets have among types the "health" type, but there are a few that have just "establishment" as type. I want as results all the dentist cabinets that have among types "health" or "establishment" so I did as following:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=48.805361,2.127163&radius=5000&types=health|establishment&key=***

and it returns some results that have "health" OR "establishment" as type(not always both). For example it returns 4 results that have the "health" type.

BUT(here comes the confusion): If I query only after "health" (&types=health&) without establishment I get more results with the type "health". NOTE: As I read through the documentation the pipe | between types act as OR and not as AND so I must get all the results that have "health" OR "establishment" as a type but I don't get all of them. WHY?

Can someone help me with my confusion/issue? How does the query work with multiple types?

Thank you! Any suggestion is appreciated!

Upvotes: 1

Views: 209

Answers (2)

kaushik kumar
kaushik kumar

Reputation: 46

Not sure if this answers your question but in cases where you have more than 20 results, google returns a pagination object which can be used to fetch the additional results. We will have to handle the storing of the previous set of results. Here is the link https://developers.google.com/maps/documentation/javascript/reference#PlaceSearchPagination

Upvotes: 0

Dr.Molle
Dr.Molle

Reputation: 117354

The number of returned results is limited to 20, you'll never get "all" results for any query(except there are less than 21 matching places at all)

Upvotes: 1

Related Questions