Java API Geocoder Autocomplete max results limit

3356
2
06-04-2014 09:03 AM
PeriklisPanagiotidis
New Contributor II
Dear all,
I am trying to make a simple geocoder widget with autocomplete on but I always get up to 5 suggested results.
Is there a way to tweak that and get more?
I am using a code similar to this example:
http://developers.arcgis.com/javascript/samples/locator_widget/

Thanks in advance!
Periklis
0 Kudos
2 Replies
MichaelVolz
Esteemed Contributor
I am also interested in finding a way to get auto-complete to provide more results.

Also, would anyone know how the widget decides to return the results from the datasource?  I had a locator where I knew the auto-complete should return 25 results but it only returned 5 which did not appear to be the first 5 matches or the last 5 matches from the datasource.
0 Kudos
NicholasHaney
New Contributor III

When the geocoder dijit has the auto-complete property set to true the geocoder calls the suggest operation in REST. This operation does not support the maxLocations parameter. If you examine the JSON request you will see the maxLocations parameter is passed to the service. Examining the JSON response will show that 5 locations are always returned. The maxLocations parameter is ignored by the suggest function. The maxLocations parameter controls the results of the find operation in REST. Run your application with auto-complete disabled and maxLocations set to 25 then search for a city. Examine the JSON response and you should see more than 5 address candidates displayed.

You can view the documentation for the suggest operation here:

suggest—ArcGIS REST API: World Geocoding Service | ArcGIS for Developers

And you can compare it to the documentation for find here:

find—ArcGIS REST API: World Geocoding Service | ArcGIS for Developers