AnsweredAssumed Answered

About search widget, does the map have to be published as a feature server rather than a map server in order to use the suggestion function?

Question asked by gpan22 on Jan 18, 2016
Latest reply on Jan 18, 2016 by Girish.Yadav

I use the code like this:

var search = new Search({
        sources: [{
            featureLayer = new FeatureLayer("http://localhost:6080/arcgis/rest/services//103Map111/MapServer/0 "),
            searchFields: ["LGA_NAME11"],
            displayField: "LGA_NAME11",
            exactMatch: false,
            name: "LGA_NAME11",
            outFields: ["*"],
            placeholder: "LGA_NAME",
            maxResults: 6,
            maxSuggestions: 6,

            //Create an InfoTemplate

            infoTemplate: new InfoTemplate("LGA_NAME11", "LGA_NAME11: ${LGA_NAME11}</br>Decile: ${Decile}</br>GP: ${LGA_GP}</br>Psyc: ${LGA_Psyc}</br>clinPsycol: ${LGA_clinPs}"),
           
            enableSuggestions: true,
            minCharacters: 0
      }],
        map: map
      }, "search");
   search.startup();

 

It is quite similar with the sample code for search. However, even if  it can search the right place but cannot show suggestion. I think there is something wrong with the published map. But I have no idea on how to fix it.

Outcomes