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

ensure 'maxResults' limits the number of suggestions too #124

Merged
merged 5 commits into from
Jun 20, 2016
Merged

ensure 'maxResults' limits the number of suggestions too #124

merged 5 commits into from
Jun 20, 2016

Conversation

jgravois
Copy link
Contributor

@jgravois jgravois commented Mar 25, 2016

i would expect setting maxResults to impact how many suggestions are returned, not geocoding matches.

right now, even though 'L.esri.geosearch' passes along a maxResults parameter when ultimately calling the find operation of the World Geocoding Service, since a magicKey is included too, only one candidate is ever going to come back.

this code change has the desired effect of exposing a technique to augment the number of suggestions returned, but needs a little more testing to make sure all is well with the other providers.

@jgravois
Copy link
Contributor Author

jgravois commented Jun 10, 2016

okay, the PR got a tad sidetracked, but in my testing i noticed we were not handling custom geocoding services well previously at all.

changes/fixes:

  1. in addition to checking custom geocoding services to see if they support /suggest, also make a point to fetch alternate singleLineAddressField parameter names
  2. use /findAddressCandidates for custom geocoding services when a customParam string is either supplied in the constuctor or fetched by the metadata request above.
  3. check to make sure candidates have an extent before trying to utilize it (so we don't bomb out when making requests to old geocoding services
  4. throw a console warning and skip firing a /suggest request entirely when the service doesn't support the operation.
  5. moved to use 'watch' to rebuild source

in addition to getting tests passing, i confirmed manually that both World and legacy custom geocoders can be used successfully directly via Tasks, from Service methods and from the Geosearch control.

maxResults is honored in suggestions, find/findAddressCandidates calls, and featureServices and mapService queries too.

ready for review.

@jgravois jgravois changed the title ensure 'maxResults' limits the number of suggestions too [not ready] ensure 'maxResults' limits the number of suggestions too Jun 10, 2016
@@ -30,8 +30,15 @@ export var Geocode = Task.extend({
},

initialize: function (options) {
options = options || {};
options.url = options.url || WorldGeocodingServiceUrl;
if (typeof options !== 'undefined') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is bogus because people can pass options and still be using the World Geocoding Service.

@jgravois jgravois merged commit 2b6a80a into Esri:master Jun 20, 2016
@jgravois jgravois deleted the maxResults branch July 25, 2016 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant