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

Geocode information for search autocomplete and input query #186

Closed
2 tasks done
khusbuchandra opened this issue Feb 28, 2018 · 8 comments
Closed
2 tasks done

Geocode information for search autocomplete and input query #186

khusbuchandra opened this issue Feb 28, 2018 · 8 comments
Assignees
Labels
backend enhancement New feature or request MVP Priority Priority issue needed for MVP Release Milestons

Comments

@khusbuchandra
Copy link
Contributor

khusbuchandra commented Feb 28, 2018

Modify the backend api to include geocode information needed for Search component:

  • search/autocomplete api should pass along the lat long values along with predictions
  • endpoint for search input query to get back search results and its corresponding geocode details.

The above endpoints are needed to avoid additional calls from frontend for getting the geocode information.

@jkwening
Copy link
Contributor

jkwening commented Feb 28, 2018

overview for endpoint for search input query to get back search results and its corresponding geocode details:

  • ~/controllers/google-api-controllers.js: see exports.autocomplete code snippet as reference. Create a similar api end point using googles places search service. I would simply name the function nearBySearch.
    • key, location, and radius/rankby are required fields. For location I would pass user location, it is stored as state value. I would suggest using rankby=distance param instead of radius - which requires passing "keyword", "name", or "type". Please use "keyword" in that case and just pass search input as the keyword. Actually reading the guide further, maybe we should go with the default - rankby = prominence?
  • ~/routes/search.js: under the "Search and Places query endpoints" section, add router.get('/search/:input', <controllerFunc>); and router.post('search/:input', <controllerFunc>)
    • if used what I suggested, then = 'nearBySearch' which you will need to require into the search.js module; see line 9 for reference.
    • the first for generic search request with default params: user location for location and whichever rankby option we go with.
    • the second for flexibility for future enhancement if we want to allow user to configure personal settings which we can inject automatically into the search request calls.

@jkwening jkwening added enhancement New feature or request in progress backend MVP Priority Priority issue needed for MVP Release Milestons labels Feb 28, 2018
@jkwening jkwening added this to the Soft Launch MVP milestone Feb 28, 2018
@jkwening
Copy link
Contributor

@khusbuchandra I'll take care off: search/autocomplete api should pass along the lat long values along with predictions while you take a crack at the new end point.

@khusbuchandra
Copy link
Contributor Author

For input query search, I want to use textSearch request instead of nearby search, as it provides support for ambiguous address queries or incomplete address. Moreover the nearbySearch needs the latlng details as mandatory request parameter, which is not available similar to autocomplete in search. @jkwening , I will proceed with textsearch in case it has limitations for our usage, we can switch.

@jkwening
Copy link
Contributor

jkwening commented Feb 28, 2018

@khusbuchandra sounds good to me. If you do run into issues with textSearch, regarding the lat/lng comment for nearby search, it is needed for location biasing of what places to prioritize. As I mentioned, you can pass the user location which is stored as a state object in MapContainer, so you can pass it down to Search component as a prop.

@khusbuchandra
Copy link
Contributor Author

@jkwening , you have added /map/geocode does it means frontend should make a separate call for selected prediction or you would modify autocomplete api as well to pass geocode data for each prediction?

@jkwening
Copy link
Contributor

jkwening commented Mar 1, 2018

@khusbuchandra the former - have frontend make a separate call for the selected prediction. Else, we may end up making too many calls to the api that will surpass our limits since a user can keep changing their mind.

@khusbuchandra
Copy link
Contributor Author

Thanks @jkwening , exactly my thoughts. I even got the maxed out error today. We need to implement a strategy for that too.

@jkwening
Copy link
Contributor

jkwening commented Mar 1, 2018

Completed in PRs #188 and #189. The next steps related to this issue are in #181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend enhancement New feature or request MVP Priority Priority issue needed for MVP Release Milestons
Projects
None yet
Development

No branches or pull requests

2 participants