AnsweredAssumed Answered

Search widget against World/GeocodeServer, enableSuggestions doesn't seem to work

Question asked by azendel on Sep 8, 2015
Latest reply on Sep 9, 2015 by khutchins-esristaff

I'd like my search widget to display suggested results, as it does in the basic search example. However, I want to customize the "sources" to only return search results in my area of interest (10 counties in East Tn).  Setting the searchExtent property is effectively limiting search results to my area.  But adding these customizations to the sources seems to break the suggestions.  My codes is below.


As a side note, the highlightSympbol doesn't seem to work either.  The default blue icon is very similar to some of the point features in my map.  Any idea why it's not working as well?


I've intentionally left all of the lines that I have commented out to show the different settings/properties that I've tried.




var map = new Map("map", {
                basemap: "gray",
                center: [-83.942, 35.9728],
                zoom: 9

            var s = new Search({
                map: map,
                zoomScale: 24000,
                enableSuggestions: true
            }, "search");


            //add the home button
            var home = new HomeButton({
                map: map
            }, "HomeButton");

            var sources = [];

                locator: new Locator("//"),
                singleLineFieldName: "SingleLine",
                countryCode: "US",
                searchExtent: new Extent(
                            xmin: -9433102.5652,
                            ymin: 4232556.948,
                            xmax: -9233957.949,
                            ymax: 4356720.4646,
                            spatialReference: {
                                wkid: 102100
                outFields: ["Match_addr", "PlaceName"],
                //outFields: ["address", "PlaceName"],
                //outFields: ["*"],
                //name: "World Geocode Service",
                enableSuggestions: true,
                enableSuggestionsMenu: true,
                maxSuggestions: 5,
                suggestionDelay: 100,
                minCharacters: 0,
                placeholder: "Enter an address or place",
                highlightSymbol: new PictureMarkerSymbol('', 26, 33).setOffset(1, 1)
            s.set("sources", sources);
            //highlight symbol
            //var searchSymbol = new PictureMarkerSymbol("", 20, 20);
            //s.sources[0].highlightSymbol = searchSymbol;
            s.enableSuggestions = true;