I have displayed a map using webmap and now trying to implement the search.. but it is not doing search in the feature layer.. What is wrong I am doing?
const testLayer = map.allLayers.find(function(layer) {
return layer.title === "mytestlayer";
});
var searchWidget = new Search({
view: view,
allPlaceholder: "Search",
sources: [
{
layer: testLayer,
searchFields: ["myfield"],
suggestionTemplate: "{myfield}",
exactMatch: false,
outFields: ["*"],
name: "testing",
placeholder: "example: test"
}
]
});
view.ui.add(searchWidget, {
position: "top-right"
});
});