Search disable suggestions per service

Idea created by kmsagis on Jul 10, 2019
    New
    Score0

    This is somewhat of an Idea for a long-term implementation in the Esri World Locator service and/or WebApp Builder.

     

     

    Question for anyone on WebApp Builder team - can you create a config option or workaround to disable Suggestions for just the Esri World Locator Service for the Search Widget?  Jianxia Song  For example, it would be nice if beside each locator in Config, you have a checkbox that says 'Enable Suggestions'.  So they could be enabled for some locators and not others (like in my example, keep them on for my own locators but turn it off for World Locator)  I think for that it will require substantial WAB workaround or adding it to Locators as a URL Parameter in a future Enterprise/Server update to the REST API.  I believe once parameters are added to locator services, that could definitely open up a lot of other new possibilities and ways to solve other problems and questions so I hope that finds a way into a future update. For now a workaround in WAB GUI would be fine however.

     

    https://community.esri.com/message/808489-esri-world-geocoder-service-disable-suggestions

    https://community.esri.com/ideas/15957-locators-add-url-parameters-for-example-extent-suggest-others

     

    The reason - I do not want Esri results to pop up sometimes in Suggest list; it may be confusing such as for addresses, where if Esri addresses do not exactly coincide with results from our own address locators. You can see why users would be confused. 

     

    I do however want to retain Esri's locator if possible, so that people can search for businesses and POIs with it. I would have stuck a second Search widget with just the Esri locator on the Launchpad toolbar but I would want to hide it, and it it is not possible to squirrel it away in an Advanced group because it is not a panel widget.  

     

    It is possible to disable Suggestions for all locators, by using the following workaround, since it is part of the dijit straight from the API (thank you Cheryl from TS for helpful suggestion) per below.   However, I want to disable Suggestions only for the World Locator.

     

    adding the line as below in Search in widget.js to the dijit object:

    enableSuggestions: false,

     

     

    this.searchDijit = new Search({
    activeSourceIndex: searchSouces.length === 1 ? 0 : 'all',
    minCharacters: 4, /// kevin override speed up performance to stop it from requesting data until 4 characters entered
    allPlaceholder: jimuUtils.stripHTML(esriLang.isDefined(this.config.allPlaceholder) ?
    this.config.allPlaceholder : ""),
    autoSelect: true,
    enableSuggestions: false, // kevin - disable on ALL geocoders 
    enableButtonMode: false,
    enableLabel: false,
    enableHighlight: true,
    enableInfoWindow: true,
    showInfoWindowOnSelect: true,
    map: this.map,
    sources: searchSouces,
    theme: 'arcgisSearch'
    });
    html.place(this.searchDijit.domNode, this.searchNode);
    this.searchDijit.startup();