Skip to content

Search Engines in Fx IOS

Nishant Patel edited this page Jan 28, 2022 · 5 revisions

Overview

This document gives an overview of how Firefox-iOS handles search engines for different locales.

In short, an engine needs to be compliant and requested enough before it can be added to our app.

Compliance

When you begin typing a search query in the URLBar, you'll notice a couple things:

  • Your default search engine is already set, unless you've changed it previously in settings.
  • There might be a handful of search engines below. Tapping one will perform a search of your query with that engine.

Those engine choices were made for you according to what engines are "compliant" in your locale.

Search engine compliance for a given locale dictates your preset default search engine, along with preset quick search options. There are several steps for a "provider" (search engine partner) to become, and remain, compliant. Compliance, and what Mozilla can do with compliant engines, can be better understood by asking the Product team.

After Compliance

A compliant search engine won't always be given as an option for a locale on Firefox-iOS. If an engine is requested enough, then it's worth the effort in providing it as an option for users in their respective locales.

After that's determined, it can be handed off to engineers.

Context for Engineers

If you're only interested in the process of adding/removing compliant search engines, skip down to the Engineering Handoff section.

Relevant Files

On a fresh install, there's preset search engines for the locale you're in. For returning users, it's possible that one may have changed these presets via Settings. In both cases, these are relevant for you as of Jan 2022:

  • OpenSearch
  • DefaultSearchPrefs
  • SearchEngines
  • List.json
  • All XML files under the SearchPlugins directory.

Background

A user can be a en-US english speaker located in the United States. A user can also be a Welsh speaker located in Singapore. Our system for identifying the "correct" preset search engines will adapt to these, and countless other combinations.

List.json is responsible for this. First, note that locales are Pontoon coded, and NOT Xcode coded.

Every locale has preset search engines. Some locales may have region overrides, and some may have a hard set searchDefault (zh-CN).

Depending on your locale, the preset options for default and quick search varies. The ordering matters. If it's not specified, consider the first search engine the default.

Each search engine is responsible for describing itself. These descriptions follow a standard proposed by a9. If you want to learn more about that, see this github URL and MDN's documents about it. The XMLs that exist in our repo all adhere to this standard. However, engine codes will not be part of the XML.

Engine codes are generated and assigned to each search engine, and hardly ever change. They're extremely important. Making sure we don't mix engine codes between Australia and Canada, for example, is critical.

If you had to support a new search engine, you can expect a XML to be provided to you.

Android does it similarly to us, but Desktop has a different approach. The important things to note from desktop are the search_form and search_url fields. These URLs should match with what you see in the XMLs.

Engineering Handoff

To add, remove or reorder search engines, the developer would likely be interacting only with the engine XMLs and list.json. If you had to add engines, you'll likely need to add the XML to our repo, and edit list.json to add that engine code for the associated locale, in the order product expects. To remove engines, you'll do the opposite.

Relevant PRs

These are some historical (and one recent) PRs related to this topic:

  • Jan 2018 - Implementing the system we currently use for search engines
  • Jan 2019 - Updating the search engine code for Google
  • Nov 2019 - Adding Ecosia for De locale
  • Jan 2022 - Removing non-compliant search engines
Clone this wiki locally