Class: SearchClient
Search Client (Finsemble Connect)
The Search Client allows for any window launched by Finsemble to act as a search provider or query against the registered providers.
See the Search tutorial for an overview of using the Search Client.
Methods
-
invokeItemAction(item, action)
-
Call this when you want to trigger an action associated to a returned item. There can be multiple actions associated with a result item and only one should be fired at a time.
Name Type Description item
any This is the search result item.
action
The action object
Name Type Description name
string The name of the action that you would like to fire.
Example
FSBL.Clients.SearchClient.invokeItemAction(resultItem, action);
-
invokeProviderAction(provider)
-
Call this when you want to trigger an action associated with a provider. Not all providers register an action handler.
Name Type Description provider
Object containing the information needed to trigger an action.
Name Type Description channel
string The channel identifier which is being requested to conduct it's action
Example
FSBL.Clients.SearchClient.invokeProviderAction(provider);
-
register(params, cb)
-
Register a provider with the search service.
Name Type Description params
Params object
Name Type Description itemActionCallback
Function optional A function that is called when an item action is fired.
name
string The name of the provider.
providerActionCallback
Function optional A function that is called when a provider action is fired.
providerActionTitle
optional The title of the provider action.
searchCallback
Function A function called when a search is initialized.
cb
StandardErrorCallback optional Callback to be invoked when the provider is registered.
Example
FSBL.Clients.SearchClient.register({ name: "MyProvider", searchCallback: searchApplications, itemActionCallback: itemActionCallback, providerActionTitle: providerActionTitle, providerActionCallback:providerActionCallback }, (err, response) => { //provider has been registered });
-
search(params, cb)
-
This initiates a search.
Name Type Description params
Params object
Name Type Description text
string The text to be searched
windowName
optional Optional. Will be set to the window which is invoking the API method.
cb
Function Callback to be called as search results for each provider are returned. Results are combined as they come in. So, every response will have the complete list of results that have been returned. Example: You have two providers; provider one returns results first: you'll have an array with just provider one's data. Once provider two returns, you'll have results for provider one and provider two.
Example
FSBL.Clients.SearchClient.search({ text: "Chart", (err, response) => { //Search results will be returned here });
-
unregister(params, cb)
-
Remove a provider. This can only be done from the window that registered the provider.
Name Type Description params
Name Type Description name
string The name of the provider to be removed.
cb
Function optional The callback to be invoked after the method completes successfully.
Example
FSBL.Clients.SearchClient.unregister({ name: "MyProvider" }, function(){ });