Class: SearchClient

Search Client

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 Function

This is 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 to a provider. This may not exist on the provider.

Name Type Description
provider

This is the search result item.

Name Type Description
channel string
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 string optional

The title of the provider action.

searchCallback Function

A function called when a search is initialized.

cb Function 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
	});

This initiates a search.

Name Type Description
params

Params object

Name Type Description
text string

The name of the provider.

windowName string 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 create 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(){ });