Search widget with multiple sources

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to use the search widget to search on multiple Feature Layer Sources based in given fields. The search widget provides a capability for searching features in FeatureLayers or geocoding locations with a Locator.

To use multiple sources with the search widget, you must set search widget's sources property.

// Setting sources property of the search widget to use two feature layer sources.
var searchWidget = new Search({
    view: view,
    sources: [{
      featureLayer: {
        url: "",
      searchFields: ["DISTRICTID"],
      displayField: "DISTRICTID",
      exactMatch: false,
      outFields: ["DISTRICTID", "NAME", "PARTY"],
      name: "Congressional Districts",
      placeholder: "example: 3708",
    }, {
     featureLayer: {
        url: "",
      searchFields: ["Name", "Party"],
      suggestionTemplate: "{Name}, Party: {Party}",
      exactMatch: false,
      outFields: ["*"],
      name: "Senators",

Sample search results


There were no match results from your search criteria.