Reputation: 22684
I'm using the Places Library to search any type of nearby places by keyword within a LatLngBounds rectangle.
For example if I search for pancakes I'll get restaurants with pancakes on their menu but it will also throw in an establishment with no relation like a juice bar.
How can I get the most accurate results by providing only a keyword? My nearby search request looks like this:
var request = {
bounds: my_bounds, //The bounds within which to search for places
keyword: document.getElementById("keyword").value,
rankBy: google.maps.places.RankBy.PROMINENCE
};
I know that I can also specify a type in the request but that means that the user will have to choose an option from a list of types and I wish to keep search options as minimal as possible. Any kind advice is welcomed!
Upvotes: 1
Views: 1399
Reputation: 26
I am really being selfish here and trying to find an answer to my post - but this question may be related and someone may be able to shine some more light on it for both of us.
I have noticed on a normal Google maps search (i.e. manually in a browser) if I search for: xxxxxx loc: yyyyyyyyyy where xxxxxx is a category such as "university" and yyyyyyyyyy (note the key "loc:" - for location in the middle) is the address I want to search around I get pretty accurate results. I just tested on "pancakes" and same thing. Also many of the sites have a "Category" which lists "pancakes" (or "university") that seems to show a closer match to what is wanted and/or that could be filtered on - better than using "type" or "name". This search also give distance to - which I want but which may not be important to you.
If anyone knows how to do such a "loc:" based search from the APIs that might be the answer to our questions (or maybe just mine)?
Upvotes: 1