LayerSearchSource
require(["esri/widgets/Search/LayerSearchSource"], function(LayerSearchSource) { /* code goes here */ });esri/widgets/Search/LayerSearchSourceThe following properties define a Layer-based source whose features may be searched by a Search widget instance.
Layers created from client-side graphics are not supported.
Constructors
- new LayerSearchSource(properties)
- Parameter:properties ObjectoptionalSee the properties for a list of all the properties that may be passed into the constructor. 
Property Overview
| Name | Type | Summary | Class | |
|---|---|---|---|---|
| Boolean | Indicates whether to automatically navigate to the selected result once selected.more details | more details | SearchSource | |
| String | The results are displayed using this field.more details | more details | LayerSearchSource | |
| Boolean | Indicates to only return results that match the search value exactly.more details | more details | LayerSearchSource | |
| Object | This property replaces the now deprecated  | more details | SearchSource | |
| GetResultsHandler | Function used to get search results.more details | more details | SearchSource | |
| GetSuggestionsParameters | Function used to get search suggestions.more details | more details | SearchSource | |
| Layer | The layer queried in the search.more details | more details | LayerSearchSource | |
| Number | Indicates the maximum number of search results to return.more details | more details | SearchSource | |
| Number | Indicates the maximum number of suggestions to return for the widget's input.more details | more details | SearchSource | |
| Number | Indicates the minimum number of characters required before querying for a suggestion.more details | more details | SearchSource | |
| String | The name of the source for display.more details | more details | LayerSearchSource | |
| String[] | One or more field names used to order the query results.more details | more details | orderByFields | |
| String[] | Specifies the fields returned with the search results.more details | more details | SearchSource | |
| String | Used as a hint for the source input text.more details | more details | SearchSource | |
| Boolean | Indicates whether to display a Popup when a selected result is clicked.more details | more details | SearchSource | |
| PopupTemplate | The popup template used to display search results.more details | more details | SearchSource | |
| String | Specify this to prefix the user's input of the search text.more details | more details | SearchSource | |
| Boolean | Indicates whether to show a graphic on the map for the selected source using the resultSymbol.more details | more details | SearchSource | |
| Symbol | The symbol used to display the result.more details | more details | SearchSource | |
| String[] | An array of string values representing the names of fields in the feature layer to search.more details | more details | LayerSearchSource | |
| String | A template string used to display multiple fields in a defined order when results are displayed.more details | more details | LayerSearchSource | |
| String | Specify this to add a suffix to the user's input for the search value.more details | more details | SearchSource | |
| Boolean | Indicates whether to display suggestions as the user enters input text in the widget.more details | more details | SearchSource | |
| String | A template string used to display multiple fields in a defined order when suggestions are displayed.more details | more details | LayerSearchSource | |
| Boolean | Indicates whether to constrain the search results to the view's extent.more details | more details | SearchSource | |
| Number | The set zoom scale for the resulting search result.more details | more details | SearchSource | 
Property Details
- Indicates whether to automatically navigate to the selected result once selected. - Default Value:true
 
- displayField String
- The results are displayed using this field. Defaults to the layer's - displayFieldor the first string field.
- exactMatch Boolean
- Indicates to only return results that match the search value exactly. This property only applies to - stringfield searches.- exactMatchis always- truewhen searching fields of type- number.- Default Value:false
 
- This property replaces the now deprecated - searchQueryParams,- suggestQueryParams, and- searchExtentproperties. Please see the object specification table below for details.- Properties:
- optionalwhere StringThe where clause specified for filtering suggests or search results. optionalgeometry GeometryThe 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. 
 
- getResults GetResultsHandler inherited
- 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:
 
- getSuggestions GetSuggestionsParameters inherited
- 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:
 
- layer Layer
- The layer queried in the search. This is required. - Layers created from client-side graphics are not supported. 
- Indicates the maximum number of search results to return. - Default Value:6
 
- Indicates the maximum number of suggestions to return for the widget's input. - Default Value:6
 
- Indicates the minimum number of characters required before querying for a suggestion. - Default Value:1
 
- name String
- The name of the source for display. 
- One or more field names used to order the query results. Specfiy - ASC(ascending) or- DESC(descending) after the field name to control the order. The default order is- ASC.
- Specifies the fields returned with the search results. 
- Used as a hint for the source input text. 
- Indicates whether to display a Popup when a selected result is clicked. 
- popupTemplate PopupTemplate inherited
- 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. 
- Specify this to prefix the user's input of the search text. 
- Indicates whether to show a graphic on the map for the selected source using the resultSymbol. 
- The symbol used to display the result. 
- An array of string values representing the names of fields in the feature layer to search. 
- searchTemplate String
- A template string used to display multiple fields in a defined order when results are displayed. Example:- LayerSearchSource.searchTemplate = "{County}, {State}";
- Specify this to add a suffix to the user's input for the search value. 
- Indicates whether to display suggestions as the user enters input text in the widget. - Default Value:true
 
- suggestionTemplate String
- A template string used to display multiple fields in a defined order when suggestions are displayed. This takes precedence over - displayField. Field names in the template must have the following format:- {FieldName}. An example suggestionTemplate could look something like:- Name: {OWNER}, Parcel: {PARCEL_ID}.Example:- LayerSearchSource.suggestionTemplate = "Name: {OWNER}, Parcel: {PARCEL_ID}";
- Indicates whether to constrain the search results to the view's extent. - Default Value:false
 
- The set zoom scale for the resulting search result. This scale is automatically honored. 
Method Overview
| Name | Return Type | Summary | Class | |
|---|---|---|---|---|
| LayerSearchSource | Creates a deep clone of this object.more details | more details | LayerSearchSource | |
| * | 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 details | LayerSearchSource | |
| Object | Converts an instance of this class to its ArcGIS portal JSON representation.more details | more details | LayerSearchSource | 
Method Details
- clone(){LayerSearchSource}
- Creates a deep clone of this object. Returns:- Type - Description - LayerSearchSource - A clone of the new LayerSearchSource instance. 
- 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 - jsonparameter 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:- Type - Description - * - 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() topic in the Guide for more information. Returns:- Type - Description - Object - The ArcGIS portal JSON representation of an instance of this class.