We're trying to remove the default ArcGIS World Geocoding Service from the Search Component, and replacing with our own layers and locators.
1. Legacy documentation suggests passing an empty list of sources first; this does not work (and probably shouldn't). Solved: How to hide "Esri World Geocoder" in the search wi... - Esri Community
2. More contemporary discussion suggests setting the .includeDefaultSources property to 'false'. The sample documentation illustrates this working by setting a property during a call to the widget's Constructor. Solved: How do I disable the ArcGIS World Geocoding Servic... - Esri Community
3. Now with Components, we're able to follow this Search component with multiple sources to get our custom searches defined. But, the Geocoding Service appears above any local results, and we'd like to remove results from halfway across the globe: from Console.log, we find the '.includeDefaultSources' property as undefined and setting the property to false has no effect on the Search widget.
We could step back to using the Constructors over the Components, but it seems like there should be a better way forward?
Any suggestions?
Solved! Go to Solution.
Hi @D_Atkins, I just went through this same issue recently. It sounds like you're looking for the Search component's 'includeDefaultSourcesDisabled' property, which has the corresponding 'include-default-sources-disabled' attribute. Here's the documentation link: https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-search/#includeDefa...
In your HTML, you can do this to remove the Esri geocoding service from the Search component:
<arcgis-search
id="searchbar"
include-default-sources-disabled
></arcgis-search>
If you prefer to set it via JavaScript, I think (but do not know) that this would work:
const search = document.querySelector('#searchbar')
search.includeDefaultSourcesDisabled = true;
Hi @D_Atkins, I just went through this same issue recently. It sounds like you're looking for the Search component's 'includeDefaultSourcesDisabled' property, which has the corresponding 'include-default-sources-disabled' attribute. Here's the documentation link: https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-search/#includeDefa...
In your HTML, you can do this to remove the Esri geocoding service from the Search component:
<arcgis-search
id="searchbar"
include-default-sources-disabled
></arcgis-search>
If you prefer to set it via JavaScript, I think (but do not know) that this would work:
const search = document.querySelector('#searchbar')
search.includeDefaultSourcesDisabled = true;