Skip To ContentArcGIS for DevelopersSign In Dashboard
require(["esri/widgets/Search/SearchSource"], function(SearchSource) { /* code goes here */ });
Class: esri/widgets/Search/SearchSource
Inheritance: SearchSource Accessor
Since: ArcGIS API for JavaScript 4.0

The following properties define generic sources properties for use in the Search widget. Please see the sublasses that extend this class for more information about working with Search widget sources.

See also:

Constructors

new SearchSource(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
Boolean

Indicates whether to automatically navigate to the selected result once selected.

more details
more detailsSearchSource
String

The name of the class.

more details
more detailsAccessor
Object

For filtering suggests or search results.

more details
more detailsSearchSource
GetResultsHandler

Function used to get search results.

more details
more detailsSearchSource
GetSuggestionsParameters

Function used to get search suggestions.

more details
more detailsSearchSource
Number

Indicates the maximum number of search results to return.

more details
more detailsSearchSource
Number

Indicates the maximum number of suggestions to return for the widget's input.

more details
more detailsSearchSource
Number

Indicates the minimum number of characters required before querying for a suggestion.

more details
more detailsSearchSource
String[]

Specifies the fields returned with the search results.

more details
more detailsSearchSource
String

Used as a hint for the source input text.

more details
more detailsSearchSource
Boolean

Indicates whether to display a Popup when a selected result is clicked.

more details
more detailsSearchSource
PopupTemplate

The popup template used to display search results.

more details
more detailsSearchSource
String

Specify this to prefix the user's input of the search text.

more details
more detailsSearchSource
Boolean

Indicates whether to show a graphic on the map for the selected source using the resultSymbol.

more details
more detailsSearchSource
Symbol

The symbol used to display the result.

more details
more detailsSearchSource
String

Specify this to add a suffix to the user's input for the search value.

more details
more detailsSearchSource
Boolean

Indicates whether to display suggestions as the user enters input text in the widget.

more details
more detailsSearchSource
Boolean

Indicates whether to constrain the search results to the view's extent.

more details
more detailsSearchSource
Number

The set zoom scale for the resulting search result.

more details
more detailsSearchSource

Property Details

autoNavigate Boolean

Indicates whether to automatically navigate to the selected result once selected.

Default Value:true
declaredClass Stringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

filter Object
Since: ArcGIS API for JavaScript 4.4

For filtering suggests or search results. Please see the object specification table below for details.

Properties:
where String
optional

The where clause specified for filtering suggests or search results.

geometry Geometry
optional

The filter geometry for suggests or search results. Extent is the only supported geometry when working with locator sources. See Find Address Candidates for additional information.

Function used to get search results. See GetResultsHandler for the function definition. When resolved, returns an object containing an array of search results.

Default Value:null
See also:

Function used to get search suggestions. See GetSuggestionsParameters for the function definition. When resolved, returns an object containing an array of suggest results.

Default Value:null
See also:
maxResults Number

Indicates the maximum number of search results to return.

Default Value:6
maxSuggestions Number

Indicates the maximum number of suggestions to return for the widget's input.

Default Value:6
minSuggestCharacters Number

Indicates the minimum number of characters required before querying for a suggestion.

Default Value:1
outFields String[]

Specifies the fields returned with the search results.

placeholder String

Used as a hint for the source input text.

popupEnabled Boolean

Indicates whether to display a Popup when a selected result is clicked.

popupTemplate PopupTemplate

The popup template used to display search results. If no popup is needed, set the source's popupTemplate to null.

This property should be set in instances where there is no existing PopupTemplate configured. For example, feature sources will default to any existing popupTemplate configured on the layer.

prefix String

Specify this to prefix the user's input of the search text.

resultGraphicEnabled Boolean

Indicates whether to show a graphic on the map for the selected source using the resultSymbol.

resultSymbol Symbol

The symbol used to display the result.

Known Limitations

This property only applies when the layer/locator/source is not part of the map.

suffix String

Specify this to add a suffix to the user's input for the search value.

suggestionsEnabled Boolean

Indicates whether to display suggestions as the user enters input text in the widget.

Default Value:true
withinViewEnabled Boolean

Indicates whether to constrain the search results to the view's extent.

Default Value:false
zoomScale Number

The set zoom scale for the resulting search result. This scale is automatically honored.

Default Value:null
Example:
var searchWidget = new Search({
  view: view,
  sources: [
    {
      layer: featureLayer,
      searchFields: ["Name", "Team"],
      name: "LayerSearchSource",
      zoomScale: 500000
    }
  ]
});

Method Overview

NameReturn TypeSummaryClass
*

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform.

more details
more detailsSearchSource
Object

Converts an instance of this class to its ArcGIS portal JSON representation.

more details
more detailsSearchSource

Method Details

fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter:
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns:
TypeDescription
*Returns a new instance of this class.
toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns:
TypeDescription
ObjectThe ArcGIS portal JSON representation of an instance of this class.

Type Definitions

GetResultsHandler(params){Promise<SearchResult[]>}

Function definition for the getResults property.

Parameters:
Specification:
params Object

An object that is passed as a parameter to get search results.

Specification:
exactMatch Boolean
optional

The key field used to find the result.

location Point
optional

The location value used by the Search.

maxResults Number
optional

Indicates the maximum number of search results to return.

sourceIndex Number
optional

Indicates the index of the search source.

spatialReference SpatialReference
optional

Indicates the Spatial Reference defined by the source.

suggestResult SuggestResult

Indicates the Suggest Result that triggered the search for a result.

optional

Indicates the view provided to the Search Widget using the source.

Returns:
TypeDescription
Promise<SearchResult[]>When resolved, returns an object containing an array of search results.
GetSuggestionsParameters(params){Promise<SuggestResult[]>}

Function definition for the getSuggestions() property.

Parameters:
Specification:
params Object

An object that is passed as a parameter to get search suggestions.

Specification:
maxSuggestions Number
optional

Indicates the maximum number of suggestions to return for the widget's input.

sourceIndex Number
optional

Indicates the index of the search source.

spatialReference SpatialReference
optional

Indicates the Spatial Refeference defined by the source.

suggestTerm String
optional

Indicates search term used to find a suggestion.

optional

Indicates the view provided to the Search Widget using the source.

Returns:
TypeDescription
Promise<SuggestResult[]>When resolved, returns an object containing an array of suggest results.

API Reference search results

NameTypeModule
Loading...