RustSearch.sys.mjs

class RustSearch.sys.SearchEngineSelector()

SearchEngineSelector parses the JSON configuration for search engines and returns the applicable engines depending on their region + locale.

RustSearch.sys.SearchEngineSelector.clearSearchConfig()

Clears the search configuration from memory if it is known that it is not required for a time, e.g. if the configuration will only be re-filtered after an app/environment update.

RustSearch.sys.SearchEngineSelector.filterEngineConfiguration(userEnvironment)

Filters the search configuration with the user’s given environment, and returns the set of engines and parameters that should be presented to the user.

Returns:

RefinedSearchConfig

RustSearch.sys.SearchEngineSelector.setSearchConfig(configuration)

Sets the search configuration from the given string. If the configuration string is unchanged since the last update, the cached configuration is reused to avoid unnecessary reprocessing. This helps optimize performance, particularly during test runs where the same configuration may be used repeatedly.

static RustSearch.sys.SearchEngineSelector.init()

init

Returns:

SearchEngineSelector

class RustSearch.sys.JsonEngineUrl()

Defines an individual search engine URL. This is defined separately to types::SearchEngineUrl as various fields may be optional in the supplied configuration.

RustSearch.sys.JsonEngineUrl.base

type: string

The PrePath and FilePath of the URL. May include variables for engines which have a variable FilePath, e.g. {searchTerm} for when a search term is within the path of the url.

RustSearch.sys.JsonEngineUrl.method

type: JSONEngineMethod

The HTTP method to use to send the request (GET or POST). If the engine definition has not specified the method, it defaults to GET.

RustSearch.sys.JsonEngineUrl.params

type: Array.<SearchUrlParam>

The parameters for this URL.

RustSearch.sys.JsonEngineUrl.searchTermParamName

type: string

The name of the query parameter for the search term. Automatically appended to the end of the query. This may be skipped if {searchTerm} is included in the base.

class RustSearch.sys.JsonEngineUrls()

Reflects types::SearchEngineUrls, but using EngineUrl.

RustSearch.sys.JsonEngineUrls.search

type: JSONEngineUrl

The URL to use for searches.

RustSearch.sys.JsonEngineUrls.suggestions

type: JSONEngineUrl

The URL to use for suggestions.

RustSearch.sys.JsonEngineUrls.trending

type: JSONEngineUrl

The URL to use for trending suggestions.

class RustSearch.sys.RefinedSearchConfig()

Details of the search engines to display to the user, generated as a result of processing the search configuration.

RustSearch.sys.RefinedSearchConfig.appDefaultEngineId

type: string

The identifier of the engine that should be used for the application default engine. If this is undefined, an error has occurred, and the application should either default to the first engine in the engines list or otherwise handle appropriately.

RustSearch.sys.RefinedSearchConfig.appPrivateDefaultEngineId

type: string

If specified, the identifier of the engine that should be used for the application default engine in private browsing mode. Only desktop uses this currently.

RustSearch.sys.RefinedSearchConfig.engines

type: Array.<SearchEngineDefinition>

A sorted list of engines. Clients may use the engine in the order that this list is specified, or they may implement their own order if they have other requirements.

The application default engines should not be assumed from this order in case of future changes.

The sort order is:

  • Application Default Engine

  • Application Default Engine for Private Mode (if specified & different)

  • Engines sorted by descending SearchEngineDefinition.orderHint

  • Any other engines in alphabetical order (locale based comparison)

class RustSearch.sys.SearchEngineDefinition()

A definition for an individual search engine to be presented to the user.

RustSearch.sys.SearchEngineDefinition.aliases

type: Array.<string>

A list of aliases for this engine.

RustSearch.sys.SearchEngineDefinition.charset

type: string

The character set this engine uses for queries.

RustSearch.sys.SearchEngineDefinition.classification

type: SearchEngineClassification

The classification of search engine according to the main search types (e.g. general, shopping, travel, dictionary). Currently, only marking as a general search engine is supported. On Android, only general search engines may be selected as “default” search engines.

RustSearch.sys.SearchEngineDefinition.identifier

type: string

The identifier of the search engine. This is used as an internal identifier, e.g. for saving the user’s settings for the engine. It is also used to form the base telemetry id and may be extended by telemetrySuffix.

RustSearch.sys.SearchEngineDefinition.name

type: string

The user visible name of the search engine.

RustSearch.sys.SearchEngineDefinition.optional

type: Boolean

This search engine is presented as an option that the user may enable. The application should not include these in the default list of the user’s engines. If not supported, it should filter them out.

RustSearch.sys.SearchEngineDefinition.orderHint

type: number

A hint to the order that this engine should be in the engine list. This is derived from the engineOrders section of the search configuration. The higher the number, the nearer to the front it should be. If the number is not specified, other methods of sorting may be relied upon (e.g. alphabetical).

RustSearch.sys.SearchEngineDefinition.partnerCode

type: string

The partner code for the engine. This will be inserted into parameters which include {partnerCode}. May be the empty string.

RustSearch.sys.SearchEngineDefinition.telemetrySuffix

type: string

Optional suffix that is appended to the search engine identifier following a dash, i.e. <identifier>-<suffix>

RustSearch.sys.SearchEngineDefinition.urls

type: SearchEngineUrls

The URLs associated with the search engine.

class RustSearch.sys.SearchEngineUrl()

Defines an individual search engine URL.

RustSearch.sys.SearchEngineUrl.base

type: string

The PrePath and FilePath of the URL. May include variables for engines which have a variable FilePath, e.g. {searchTerm} for when a search term is within the path of the url.

RustSearch.sys.SearchEngineUrl.method

type: string

The HTTP method to use to send the request (GET or POST). If the engine definition has not specified the method, it defaults to GET.

RustSearch.sys.SearchEngineUrl.params

type: Array.<SearchUrlParam>

The parameters for this URL.

RustSearch.sys.SearchEngineUrl.searchTermParamName

type: string

The name of the query parameter for the search term. Automatically appended to the end of the query. This may be skipped if {searchTerm} is included in the base.

class RustSearch.sys.SearchEngineUrls()

The URLs associated with the search engine.

RustSearch.sys.SearchEngineUrls.search

type: SearchEngineUrl

The URL to use for searches.

RustSearch.sys.SearchEngineUrls.suggestions

type: SearchEngineUrl

The URL to use for suggestions.

RustSearch.sys.SearchEngineUrls.trending

type: SearchEngineUrl

The URL to use for trending suggestions.

class RustSearch.sys.SearchUrlParam()

Parameter definitions for search engine URLs. The name property is always specified, along with one of value, experiment_config or search_access_point.

RustSearch.sys.SearchUrlParam.experimentConfig

type: string

The value for the parameter will be derived from the equivalent experiment configuration value. Only desktop uses this currently.

RustSearch.sys.SearchUrlParam.name

type: string

The name of the parameter in the url.

RustSearch.sys.SearchUrlParam.value

type: string

The parameter value, this may be a static value, or additionally contain a parameter replacement, e.g. {inputEncoding}. For the partner code parameter, this field should be {partnerCode}.

class RustSearch.sys.SearchUserEnvironment()

The user’s environment that is used for filtering the search configuration.

RustSearch.sys.SearchUserEnvironment.appName

type: SearchApplicationName

The application name that the user is using.

RustSearch.sys.SearchUserEnvironment.deviceType

type: SearchDeviceType

The device type that the user is using.

RustSearch.sys.SearchUserEnvironment.distributionId

type: string

The distribution id for the user’s build.

RustSearch.sys.SearchUserEnvironment.experiment

type: string

The search related experiment id that the user is included within. On desktop this is the searchConfiguration.experiment variable.

RustSearch.sys.SearchUserEnvironment.locale

type: string

The current locale of the application that the user is using.

RustSearch.sys.SearchUserEnvironment.region

type: string

The home region that the user is currently identified as being within. On desktop & android there is a 14 day lag after detecting a region change before the home region changes. TBD: iOS?

RustSearch.sys.SearchUserEnvironment.updateChannel

type: SearchUpdateChannel

The update channel of the user’s build.

RustSearch.sys.SearchUserEnvironment.version

type: string

The application version that the user is using.

class RustSearch.sys.JsonEngineMethod()

The list of possible submission methods for search engine urls.

RustSearch.sys.JsonEngineMethod.GET

GET

RustSearch.sys.JsonEngineMethod.POST

POST

class RustSearch.sys.SearchApplicationName()

The list of possible application names that are currently supported.

RustSearch.sys.SearchApplicationName.FIREFOX

FIREFOX

RustSearch.sys.SearchApplicationName.FIREFOX_ANDROID

FIREFOX_ANDROID

RustSearch.sys.SearchApplicationName.FIREFOX_IOS

FIREFOX_IOS

RustSearch.sys.SearchApplicationName.FOCUS_ANDROID

FOCUS_ANDROID

RustSearch.sys.SearchApplicationName.FOCUS_IOS

FOCUS_IOS

class RustSearch.sys.SearchEngineClassification()

The list of acceptable classifications for a search engine.

RustSearch.sys.SearchEngineClassification.GENERAL

GENERAL

RustSearch.sys.SearchEngineClassification.UNKNOWN

UNKNOWN

class RustSearch.sys.SearchUpdateChannel()

The list of possible update channels for a user’s build. Use default for a self-build or an unknown channel.

RustSearch.sys.SearchUpdateChannel.AURORA

AURORA

RustSearch.sys.SearchUpdateChannel.BETA

BETA

RustSearch.sys.SearchUpdateChannel.DEFAULT

DEFAULT

RustSearch.sys.SearchUpdateChannel.ESR

ESR

RustSearch.sys.SearchUpdateChannel.NIGHTLY

NIGHTLY

RustSearch.sys.SearchUpdateChannel.RELEASE

RELEASE

class RustSearch.sys.Other()

Other