Skip to content

Conversation

@cyndichin
Copy link
Contributor

@cyndichin cyndichin commented Nov 7, 2025

📜 Tickets

Jira ticket
Github issue

💡 Description

The trending url for google was only showing a list of terms related to search terms and not the actual trending searches. We should be using /complete/search?q=&client=firefox&channel=ftr instead. Added an override bool overrideSearchArg to avoid appending searchTerms to the search query argument.

🎥 Demos

Before After
simulator_screenshot_A0427DB4-C4A5-485B-9F48-0FD3CFD82ED1 Simulator Screenshot - iPhone 16e - 2025-11-07 at 12 59 56

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code

@cyndichin cyndichin requested a review from a team as a code owner November 7, 2025 18:03
@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Nov 7, 2025

Messages
📖 Project coverage: 38.63%

🧹 Tidy commit

Just 1 file(s) touched. Thanks for keeping it clean and review-friendly!

💬 Description craftsman

Great PR description! Reviewers salute you 🫡

✅ Per-file coverage

All changed files meet the threshold of 35.0%.

Client.app: Coverage: 37.15

File Coverage
OpenSearchEngine.swift 82.72%

Generated by 🚫 Danger Swift against 1297c13

Comment on lines 16 to 20
let trendingTemplate = convertASSearchURLToOpenSearchURL(
engine.urls.trending,
for: engine,
overrideSearchArg: false
) ?? ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cyndichin If we're always wanting this behavior for trending URLs, why are we having to override this on the client. Shouldn't this be fixed in the source data (on Remote Settings)? Apologies if I'm misunderstanding or missing something obvious. 👀

Copy link
Contributor Author

@cyndichin cyndichin Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for calling this out @mattreaganmozilla !!

Summarizing what we discussed on slack:

why are we having to override this on the client.

We get this configuration from remote settings:

Optional<SearchEngineUrl>
  ▿ some : SearchEngineUrl
    - base : "https://www.google.com/complete/search"
    - method : "GET"
    ▿ params : 2 elements
      ▿ 0 : SearchUrlParam
        - name : "client"
        ▿ value : Optional<String>
          - some : "firefox"
        - enterpriseValue : nil
        - experimentConfig : nil
      ▿ 1 : SearchUrlParam
        - name : "channel"
        ▿ value : Optional<String>
          - some : "ftr"
        - enterpriseValue : nil
        - experimentConfig : nil
    ▿ searchTermParamName : Optional<String>
      - some : "q"
    - displayName : nil
    - isNewUntil : nil
    - excludePartnerCodeFromTelemetry : false
    - acceptedContentTypes : nil

However, on our side we are parsing the details and formatting into a url via convertASSearchURLToOpenSearchURL. It seems that for our searchTermParamName we are always appending {searchTerms}, but we don't want to do that for trending searches. Therefore, we added an override here.

For trending searches, we want the following url - https://www.google.com/complete/search?client=firefox&channel=ftr&q=

Shouldn't this be fixed in the source data (on Remote Settings)?

We discussed that maybe it makes more sense to not have q under searchTermParamName and instead maybe have it under base or param. Pinged Mark on the consolidated search channel and will wait to hear back on this before proceeding next steps.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Cyndi for documenting this 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So instead of trying to parse the URL differently from remote settings, it was recommended that we should still pass through {searchTerms}, which for the other urls should be replaced by the actual search term. However, for trending searches should be the empty string q=. Updated PR with this commit: 1297c13

@cyndichin cyndichin force-pushed the cc/FXIOS-14056_bugfix-for-google-trending-url branch from 6307aa5 to 1297c13 Compare November 10, 2025 19:16
func trendingURLForEngine() -> URL? {
guard let trendingTemplate else { return nil }
return URL(string: trendingTemplate)
return getURLFromTemplate(trendingTemplate, query: "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@cyndichin cyndichin merged commit 49a4258 into main Nov 10, 2025
8 checks passed
@cyndichin cyndichin deleted the cc/FXIOS-14056_bugfix-for-google-trending-url branch November 10, 2025 19:42
@github-actions
Copy link
Contributor

🚀 PR merged to main, targeting version: 145.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants