parametersearch
This bundle provides a way to search for items in a store when the app starts up when a q
parameter with the search term is appended to the app's URL.
You can define a list of actions to execute after a search completed. By default, these are the actions highlight
, zoomto
, and openpopup
.
Usage
There must be a store configured in your app to search on. For example, to search within an AGS layer you can utilize the agssearch bundle to define a store.
In the following sample the app is started with a q
and a source
parameter.
Therefore a search for "berlin" is performed on the store that has the ID "myStoreId".
.../my-app/index.html?q=berlin&source=myStoreId
If the search returns a result, the actions configured in the actions
property are triggered.
If a popup is defined for the store, the popup is opened automatically.
Configuration Reference
The following sample shows the configurable properties and their default values:
{
"Config": {
"actions": ["zoomto", "highlight", "openpopup"],
"defaultStoreId": "",
"ensureGeometryInMapSRS": true,
"useOnlyFirstResult": true,
"zoomto-point-scale": 1000,
"<action-property>": "value"
}
}
Properties
Property | Type | Description |
---|---|---|
actions |
Array | A list of the IDs of the actions to execute after the search completes. See the bundle map-actions for a list of available actions. |
defaultStoreId |
String | ID of the store to be used for the search when no store ID is defined in the source URL parameter. If neither the source URL parameter nor the defaultStoreId are defined the search and hence all associated actions are not executed. |
ensureGeometryInMapSRS |
Boolean | Allows the deactivation of geometry transformations of result items if they do not match the spatial reference system of the map. |
useOnlyFirstResult |
Boolean | By default only the first item matching the search query is used. To react on multiple results, set this property to false and make sure to use actions that can react on multiple items. |
<action-property> |
Any | This is a placeholder for properties defined by actions listed in the property actions . |
WARNING: The whole workflow is only started if all
actions
are available. Custom actions may require components which start late. The waiting is required to ensure that these actions are informed about the search results.
How to configure actions
For configuration options of the highlight
and zoomto
actions consider the map-actions
documentation.
See map-actions
how to add custom actions, too.