The Search widget enables end users to find locations or search features on the map. By default, the widget uses the geocoding service from your organization or portal and displays searchable layers configured in the map, if available. See Configure feature search for more information. Further, you can add more geocoding services or configure specific layers within your map to be searchable using the widget's configuration window.
The following methods of finding a location are supported, given that they are supported in the geocoding services:
- Place-name
- Point of interest
- Address
The following layers are searchable with Query capability enabled:
- Hosted feature layers
- ArcGIS for Server feature service layers
- ArcGIS for Server map service layers
Configuring the Search widget
The widget configuration window allows you to specify the geocoding services and searchable layers you want the widget to work with.
- Hover over the Search widget and click the small eye icon to show or hide this widget in your application.
- Hover over the widget and click the small edit icon . The configuration window for this widget opens.
- By default, the widget uses the geocoding service from your organization or portal and displays searchable layers configured in the map, if available. All the existing search sources are listed on the table. You can add new search sources or modify the existing ones. You'll add new search sources first.
- Click Add Search Source. There are two options: Geocoder and Feature Layer.
- Choose Feature Layer.
- Click a radio button to choose a layer and click OK to close the window.
- The new layer source is automatically listed on the table. You can change the searchable layer name in the Name text box.
- Optionally type the text in the Placeholder Text text box.
- Click the pencil icon to add search fields. This opens the Set Search Fields window. Choose one or multiple fields. Numerical fields and string fields, including coded domains, are searchable. Click OK to close the window. You should see all the selected fields listed in the Search Fields text box.
- Click the drop-down list to choose the display field in the search suggestion.
- By default, 6 is the maximum suggestions returned for a searchable layer. Change it if necessary.
- By default, 6 is the maximum results returned for a searchable layer. Change it if necessary.
- Be default, zoom scale is defined as 1:50,000. Change it if necessary.
- Optionally check the Exact Match box if needed.
- Optionally check the Only search in current map extent box if needed.
- Choose Geocoder.
- The new Geocoder source is automatically listed on the table.
- Click the Set button to open the Set Geocoder URL window.
- Provide a valid URL for the geocoding service you want to use, click Validate to load the service, choose the service, and click OK.
The geocoder URL is automatically added in the Geocoder URL text box. You can change the geocoder name in the Geocode Name text box.
- Optionally type text in the Placeholder Text text box.
- Optionally type the country code to limit the search area. See Geocode coverage for a country code list.
- By default, 6 is the maximum results returned. Change it if necessary.
- Optionally check the Only search in current map extent box if needed.
- Repeat step 4 to add more feature layers and geocoder search sources.
- To modify the existing search sources, click the source on the table.
- Under General Settings, set the placeholder text for searching all of the layers and geocoders.
- By default, the pop-up displays when the feature or location is found on the map. Uncheck the box to disable the pop-up.
- Click OK to close the configuration window.
Using the Search widget
- When you enter a place-name or a keyword in the search box, you see suggestions as you type. If you see an arrow in the search box, you can search on all sources, or click the arrow and choose a locator or layer form the drop-down list.
- A pop-up appears at the location of the place-name or the feature and displays any available attribute information.