Search and find functionality
The Geocoder component provides easy map navigation by adding a search box. This search box enables users to move to a location much quicker and easier than standard panning/zooming. The search box provides the search capabilities based on a given locator service and/or map services.
This component wraps pre-built search functionality directly in it so all you need to do is reference the component within your application. If working with a locator, the component defaults to the ArcGIS Online World Geocoding Service. It can also be customized to work with another defined geocoding service. In addition to geocoding services, the Geocoder component also has the ability to work with or without layers within your map service. You specify how you wish the component to work by using either a geocoding service, map service layer(s), or both.
This component provides properties such as whether you wish to have the results autocomplete and navigate once found. You can also specify whether you wish to work with GeocoderLocatorOptions.. A couple of these options include properties such as what fields you wish to display in the resulting features and the search extent used when geocoding.
This geocoding capability works off of a locator service that is configured to use a single line address field.
If using your own geocode locator service, it will need to be configured to use single line style similar to how the default locator service is configured.
If you wish to search using map service layer(s). Reference the mapServices property on the Geocoder component. This property takes an array of geocoderMapServices. Here, you can specify the layerids you wish to search, fields to search, and so forth. The selected search result is returned as a GeocoderSearchResult. After the results display, listen for the resultSelected event and handle the results as needed.
See the Geocoder API sample for additional details.
In addition to the API sample, you may also want to take a look at the GeocoderComponent in the ArcGIS Viewer for Flex application. This takes the underlying Geocoder component and uses it to perform similar search functionality within the Viewer. The source for the Viewer can be accessed from Github. Once in the application, you can find this component under src/com.esri.viewer/components.