SearchRequest RPC
Make a search query
Use cases
- Make a generic search to get location results
Description
Requests search results (addresses, locations) by given params. After the search is completed a SearchResultEvent
is triggered where following data is available:
- event.getSuccess(), returns boolean. If
true
, search is done and there is no errors - event.getResult(), returns search result object. Look at searchresultevent.md for more details
- event.getRequestParameters(), returns the
query
that was used for searching - event.getOptions(), returns options used when requesting search if any
Parameters
(* means the parameter is required)
Name | Type | Description | Default value |
---|---|---|---|
\* query | String | address or location to be searched | |
options | Object | Arbitratry options to send to server side implementation. These might get handled or not depending on the backend implementation/search channel. A common handling is for key `limit` so client can request less or more results than the instance default. However the instance admin can set a hard limit for results. | {} |
Examples
Get search result in an RPC application:
var query = "Finland";
channel.postRequest('SearchRequest', [ query ]);
Same search but limit results to 10:
var query = "Finland";
channel.postRequest('SearchRequest', [ query, { 'limit': 10 } ]);
Related api
- SearchResultEvent