The Search widget within the ArcGIS JavaScript API (v 4.9) works by returning all records that contain your search string. In other words, if you search for "123" You'll get "123 S Main St", "5123 W Oak St", "Painting 123", and more. I just want to limit the search to only those records starting with the search string, not everything containing it. There seems to be no exposed way however to alter what appears to be the "LIKE %search string%" query baked into the widget. Has anyone been able to accomplish this?


The default source for the Search widget is the Esri World Geocoder. The suggest endpoint of the Geocoder does not allow this query format that you're asking about, so I don't think that's possible. If you have a Feature Service of your address points, you can do what you want by defining your own "source" to point the Search widget at your Feature Service, and then using esriConfig.request.interceptors to modify the request -- something like this:

  // set the `urls` property to the URL of the FeatureLayer so that this
  // interceptor only applies to requests made to the FeatureLayer URL
  urls: "https://ccmap.cccounty.us/arcgis/rest/services/LUCA/LUCA_ADDRESS/FeatureServer/0",
  // use the BeforeInterceptorCallback to check if the query of the
  // FeatureLayer has a where property set.
  // if so, then modify the "where" property how we want it to be.
  before: function(params) {
    if (params.requestOptions.query.where) {
      params.requestOptions.query.where = params.requestOptions.query.where.replace(

Full demo here.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.