android-components / mozilla.components.feature.awesomebar / AwesomeBarFeature / addSearchProvider

addSearchProvider

fun addSearchProvider(searchEngine: SearchEngine, searchUseCase: SearchUseCase, fetchClient: Client, limit: Int = 15, mode: Mode = SearchSuggestionProvider.Mode.SINGLE_SUGGESTION, engine: Engine? = null): AwesomeBarFeature (source)

Adds a AwesomeBar.SuggestionProvider for search engine suggestions to the AwesomeBar.

Parameters

searchEngine - The search engine to request suggestions from.

searchUseCase - The use case to invoke for searches.

fetchClient - The HTTP client for requesting suggestions from the search engine.

limit - The maximum number of suggestions that should be returned. It needs to be >= 1.

mode - Whether to return a single search suggestion (with chips) or one suggestion per item.

engine - optional Engine instance to call Engine.speculativeConnect for the highest scored search suggestion URL.fun addSearchProvider(context: <ERROR CLASS>, searchEngineManager: SearchEngineManager, searchUseCase: SearchUseCase, fetchClient: Client, limit: Int = 15, mode: Mode = SearchSuggestionProvider.Mode.SINGLE_SUGGESTION, engine: Engine? = null): AwesomeBarFeature (source)

Adds a AwesomeBar.SuggestionProvider for search engine suggestions to the AwesomeBar. If the default search engine is to be used for fetching search engine suggestions then this method is preferable over addSearchProvider, as it will lazily load the default search engine using the provided SearchEngineManager.

Parameters

context - the activity or application context, required to load search engines.

searchEngineManager - The search engine manager to look up search engines.

searchUseCase - The use case to invoke for searches.

fetchClient - The HTTP client for requesting suggestions from the search engine.

limit - The maximum number of suggestions that should be returned. It needs to be >= 1.

mode - Whether to return a single search suggestion (with chips) or one suggestion per item.

engine - optional Engine instance to call Engine.speculativeConnect for the highest scored search suggestion URL.