Closed Bug 1921126 Opened 4 months ago Closed 3 months ago

Desktop changes for city-based weather suggestions

Categories

(Firefox :: Address Bar, task, P1)

task

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: adw, Assigned: adw)

References

Details

(Whiteboard: [sng-cityweather])

Attachments

(1 file)

The current desktop implementation for weather suggestions fetches and caches the user's local weather data from Merino every 30 minutes. For city-based weather, we'll need to send a request to Merino every time the query contains a city. In fact, we should probably get rid of the current caching implementation and simply ping Merino for every weather query, even queries that don't contain cities. I talked with Nan about doing that a while ago.

Whiteboard: [sng-cityweather]

(In reply to Drew Willcoxon :adw from comment #0)

In fact, we should probably get rid of the current caching implementation and simply ping Merino for every weather query, even queries that don't contain cities.

I did this part in https://mozilla-hub.atlassian.net/browse/SNG-1837, https://phabricator.services.mozilla.com/D223874 (no bug). The remaining part of this bug is to send the city/region that was parsed out by Suggest to Merino as part of the weather request.

This adds support for city-based weather suggestions from Rust, i.e., queries
that contain city and region names.

When Rust detects a weather query with a city, it sets three suggestion
properties: city, region, and country. All three properties will be set
because the Rust component knows which cities are in which regions and
countries, and it will only set the properties if it detects a city name. If a
name matches multiple cities and the query doesn't contain a region, Rust will
return multiple suggestions, one suggestion per city-region, and the suggestions
will be ordered by population size, largest to smallest.

Rust uses data from GeoNames to detect locations. We store GeoNames data in
remote settings and ingest it into the Rust DB, just like we do for suggestions
and keywords. This patch uses some mock GeoNames data in the test.

More info on the Rust part of this in the PR:
https://github.com/mozilla/application-services/pull/6406

For the Merino part, Merino now supports a few extra params for weather
suggestions: city, region, and country. So when the Rust component returns a
weather suggestion with those properties set, we can pass them to Merino to get
a weather suggestion for that location.

This patch adds a new BaseFeature method called filterSuggestions(). The
important thing about this method is that it's passed all the feature's
suggestions that were matched in the query. The feature can use this info to
determine which suggestion(s) to show. Right now, Weather uses it to discard
all weather suggestions except the first one, which means it will show the
suggestion with the largest city population (if the first suggestion has a
city). In the future, I'd like to explore better options like picking the
suggestion whose city name best matches the user's location.

Depends on D226215

Pushed by dwillcoxon@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b313e0953854 Add desktop support for city-based weather suggestions. r=daisuke
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: