Description
In ArcGIS Web AppBuilder, the Search widget enables finding locations or searching features on the map. In some instances, when searching for a location or feature on the map, the returned suggestions or results are limited, and the desired location or feature is not returned. For example, the following image shows six suggestions are returned in the Search widget when searching for ‘park’, but in fact, there are 24 features’ names starting with ‘Park’, as displayed in the Park ID field in the attribute table.
There are instances where attempts to search for a location or feature on the map using the Search widget, but no results are returned. Pressing Enter on the keyboard or clicking the Search button returns a message, ‘No results. There were no results found for “<searched_item>”.’
In a situation where a searched feature or location returns multiple matching suggestions or results, pressing Enter on the keyboard or clicking the Search button zooms to the first result on the result list instead of the exact match. For example, the following image shows the map zooms to the first result (Park A1) on the result list, instead of the exact match, Park A. Users must scroll through the result list and manually click the exact match to zoom to it.
Cause
The following are known causes for the issue:
- Limited suggestions and results are returned when the ‘Maximum suggestions’ and ‘Maximum results’ in the Search widget settings are not configured. By default, six is the maximum suggestions and results returned for a searchable layer.
- Limited suggestions and results are returned when the ‘Only search in current map extent’ check box is checked.
- The return message is displayed when the search fields parameter is not configured, or the layer is not a hosted feature layer. The layer that is added directly to the web map is not hosted in ArcGIS Online, and cannot be added as a search source in the Search widget settings.
- When the ‘Exact match’ check box is not checked, pressing Enter on the keyboard or clicking the Search button in the Search widget zooms to the first result on the search result list.
Solution or Workaround
Depending on the cause, use one of the options below to resolve the issue.
Configure the number of maximum suggestions and results returned for a searchable layer
In ArcGIS Web AppBuilder, depending on the total number of features on the map, increase the number of maximum suggestions and results returned in the Search widget.
- In ArcGIS Web AppBuilder, on the Widget tab, browse to and hover over the Search widget, and click Configure this widget.
- In the Configure Search window, under Search source settings, click the searchable layer or geocoding service.
- Depending on the total number of features on the map, increase the number for Maximum suggestions and Maximum results.
Note:
The maximum value for Maximum suggestions and Maximum results is 999,999,999,999,999.
- Click OK.
- On the Widget tab, click Save to save the configurations.
The image below shows all matching suggestions are returned when searching a feature or location using the Search widget in ArcGIS Web AppBuilder.
Uncheck the ‘Only search in current map extent’ check box to show all matching suggestions and results
In ArcGIS Web AppBuilder, uncheck the Only search in current map extent check box to show all matching suggestions and results returned in the Search widget despite the map extent.
- In ArcGIS Web AppBuilder, on the Widget tab, browse to and hover over the Search widget, and click Configure this widget.
- In the Configure Search window, under Search source settings, click the searchable layer, and uncheck the Only search in current map extent check box.
- Click OK.
- On the Widget tab, click Save to save the configurations.
Ensure a hosted feature layer is added as a search source and the search fields parameter is configured
Save and publish the layer as a hosted feature layer in ArcGIS Online to add it as a search source, and add fields for Search fields in the Search widget settings.
Note:
Steps 1 through 5c below are not required for a hosted feature layer that is already added as a search source in the Search widget settings.
- Log in to ArcGIS Online. Click Content > My Content.
- In Map Viewer Classic, save and publish the layer as a hosted feature layer in ArcGIS Online.
- On the My Content page, browse to the web map, click More Options , and select Open in Map Viewer Classic.
- In Map Viewer Classic, in the Contents pane, browse to the non-hosted feature layer, click More Options , and select Save Layer.
- In the Create Item window, specify the Title and Tags fields. Click CREATE ITEM.
- In the Contents pane, browse to the layer, click More Options , and select Remove.
- Click Save to save the map.
- In the upper left corner, click the Home drop-down list, and select Content.
- On the Content page, on the My Content tab, browse to the feature layer, click More Options , and select View item details.
- On the item details page, click Publish.
- In the Publish window, specify the Title and Tags fields, and click Publish.
- Click Content > My Content.
- Browse to the web map, click More Options , and select Open in Map Viewer Classic.
- In Map Viewer Classic, on the top panel, click Add > Search for Layers.
- In the My Content pane, browse to the hosted feature layer, and click Add to add it to the web map.
- Click Save to save the map.
- In the upper left corner, click the Home drop-down list, and select Content.
- On the Content page, on the My Content tab, browse to the ArcGIS Web AppBuilder app, click More Options , and select Edit Application.
- In ArcGIS Web AppBuilder, add the hosted feature layer as the search source, and configure the search fields.
- In ArcGIS Web AppBuilder, on the Widget tab, browse to and hover over the Search widget, and click Configure this widget.
- In the Configure Search window, under Search source settings, hover over Add search source, and select Feature layer.
- In the Set layer source window, select the hosted feature layer. Click OK.
- In the Configure Search window, under Search source settings, click the layer, and click the pencil icon next to Search fields.
- In the Set search fields window, check one or more fields, and click OK.
- In the Configure Search window, click OK.
- On the Widget tab, click Save to save the configurations.
Check the Exact match check box to search for and zoom to the exact matching feature
When multiple features on the map have similar names, check the Exact match check box to search for and zoom to the exact matching feature on the map.
Note:
By design, if the Exact match check box is unchecked, the map zooms to the first matching result on the Search widget’s search results list when pressing Enter on the keyboard or clicking the Search button. This is because search results are sorted according to the feature’s ObjectID.
- In ArcGIS Web AppBuilder, on the Widget tab, browse to and hover over the Search widget, and click Configure this widget.
- In the Configure Search window, under Search source settings, click the searchable layer, and check the Exact match check box.
- Click OK.
- On the Widget tab, click Save to save the configurations.
The image below shows the map zooms to the exact matching feature when searching for it, and pressing Enter on the keyboard or clicking the Search button in the Search widget in ArcGIS Web AppBuilder.