Skip to content

Commit

Permalink
Bug 1919541 - Implement variant handling in the search engine selector.
Browse files Browse the repository at this point in the history
  • Loading branch information
Standard8 committed Jan 7, 2025
1 parent f9539fb commit 5e3fb6c
Show file tree
Hide file tree
Showing 4 changed files with 419 additions and 44 deletions.
21 changes: 20 additions & 1 deletion components/search/src/configuration_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub(crate) struct JSONEngineUrl {
/// 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.
pub base: String,
pub base: Option<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.
Expand Down Expand Up @@ -160,9 +160,28 @@ pub(crate) struct JSONVariantEnvironment {

/// Describes an individual variant of a search engine.
#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub(crate) struct JSONEngineVariant {
/// Details of the possible user environments that this variant applies to.
pub environment: JSONVariantEnvironment,

/// This search engine is presented as an option that the user may enable.
/// If not specified, defaults to false.
#[serde(default)]
pub optional: bool,

/// The partner code for the engine or variant. This will be inserted into
/// parameters which include '{partnerCode}'
pub partner_code: Option<String>,

/// Suffix that is appended to the search engine identifier following a dash,
/// i.e. `<identifier>-<suffix>`. There should always be a suffix supplied
/// if the partner code is different for a reason other than being on a
/// different platform.
pub telemetry_suffix: Option<String>,

/// The urls for this variant.
pub urls: Option<JSONEngineUrls>,
}

/// Represents an individual engine record in the configuration.
Expand Down
Loading

0 comments on commit 5e3fb6c

Please sign in to comment.