Skip to main content

Module: SearchClient

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.

Functions

invokeItemAction

invokeItemAction(item, action): void

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.

FSBL.Clients.SearchClient.invokeItemAction(resultItem, action);

Parameters

NameTypeDescription
itemanyThis is the search result item.
actionObjectThe action object
action.namestringThe name of the action that you would like to fire.

Returns

void


invokeProviderAction

invokeProviderAction(provider): void

Call this when you want to trigger an action associated with a provider. Not all providers register an action handler.

FSBL.Clients.SearchClient.invokeProviderAction(provider);

Parameters

NameTypeDescription
providerObjectObject containing the information needed to trigger an action.
provider.channelstringThe channel identifier which is being requested to conduct it's action

Returns

void


register

register(params, cb?): StandardPromise<{ status: string }>

Register a provider with the search service.

{ status : "success" } is resolved or called back when successful.

FSBL.Clients.SearchClient.register({
name: "MyProvider",
searchCallback: searchApplications,
itemActionCallback: itemActionCallback,
providerActionTitle: providerActionTitle,
providerActionCallback:providerActionCallback
},
(err, response) => {
//provider has been registered
});

Parameters

NameTypeDescription
paramsObjectParams object
params.itemActionCallback?FunctionA function that is called when an item action is fired.
params.namestringThe name of the provider.
params.providerActionCallback?FunctionA function that is called when a provider action is fired.
params.providerActionTitle?null | stringThe title of the provider action.
params.searchCallbackFunctionA function called when a search is initialized.
cb?StandardErrorCallback<{ status: string }>Callback to be invoked when the provider is registered.

Returns

StandardPromise<{ status: string }>


search(params, cb): Promise<void>

This initiates a search.

The promise will resolve when the search has been successfully initiated but results are only returned on the callback handler. This callback handler may be called multiple times. Each time, the complete set of search results is returned. There is no indication when all results have returned.

FSBL.Clients.SearchClient.search({
text: "Chart",
(err, response) => {
//Search results will be returned here
});

Parameters

NameTypeDescription
paramsObjectParams object
params.textstringThe text to be searched
params.windowName?stringOptional. Will be set to the window which is invoking the API method.
cbFunctionCallback 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.

Returns

Promise<void>


unregister

unregister(params, cb?): Promise<void>

Remove a provider. This can only be done from the window that registered the provider.

FSBL.Clients.SearchClient.unregister({ name: "MyProvider" }, function(){ });

Parameters

NameTypeDescription
paramsObject
params.namestringThe name of the provider to be removed.
cb?FunctionThe callback to be invoked after the method completes successfully.

Returns

Promise<void>