Open Bug 2034513 Opened 11 days ago Updated 8 days ago

Autofill can suggest low-frequency origins over high-frequency ones

Categories

(Firefox :: Address Bar, defect, P3)

defect

Tracking

()

People

(Reporter: jteow, Unassigned)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [sng])

Attachments

(1 file)

As reported on Connect

Steps to reproduce:

  1. Have a high visit count origin in history (e.g., news.google.com, 565 visits).
  2. Have a low visit count origin sharing a prefix (e.g., noai.duckduckgo.com, 31 visits).
  3. Type the shared prefix in the address bar (e.g., "n").

Expected results:
The high-frequency origin (news.google.com) is autofilled, matching pre-147 behavior and the user's muscle memory.

Actual results:
The low-frequency origin (noai.duckduckgo.com) is autofilled instead. The issue persists even after:

  • Removing the unwanted origin's base URL via "Forget About This Site"
  • Updating from 147 to 148 to 150

While the behavior differs, this is not necessarily a problem as it's not based on the absolute number of visits.
Was this before or after our improvements to use number of typed?

Hi wayfaringbob, what would be helpful for me is for you to show some details that allow me to understand what is happening in your use case as it might reveal a gap in the algorithm.

Please enable the Browser Toolbox so that we can paste a script to get information about your database. If you have any issues doing this, feel free to respond here.


When you enable the browser toolbox, please paste the following code snippet and press enter in the console tab. The code runs locally and doesn't send anything to us.

(async () => {
  const { PlacesUtils } = ChromeUtils.importESModule(
    "resource://gre/modules/PlacesUtils.sys.mjs",
  );
  const db = await PlacesUtils.promiseLargeCacheDBConnection();

  const threshold = await PlacesUtils.metadata.get(
    "origin_frecency_threshold",
    2.0,
  );
  console.log("Using field: frecency | Autofill threshold:", threshold);

  const hosts = ["news.google.com", "noai.duckduckgo.com"];

  // Origin rows for just the two hosts
  const rows = await db.execute(
    `SELECT prefix, host, frecency
         FROM moz_origins
         WHERE host IN (:h1, :h2, :h3, :h4)
         ORDER BY frecency DESC`,
    { h1: hosts[0], h2: hosts[1] },
  );
  console.table(
    rows.map((r) => ({
      origin: r.getResultByName("prefix") + r.getResultByName("host"),
      frecency: r.getResultByName("frecency"),
    })),
  );

  // Simulated autofill ranking, scoped to the two hosts
  const ranked = await db.execute(
    `SELECT fixup_url(host) AS fixed_host,
                total(frecency) AS total_host_frecency,
                MAX(frecency > 1) AS any_recent_typed,
                group_concat(prefix || host, ', ') AS variants
         FROM moz_origins
         WHERE host IN (:h1, :h2, :h3, :h4)
         GROUP BY fixup_url(host)
         ORDER BY total_host_frecency DESC`,
    { h1: hosts[0], h2: hosts[1] },
  );
  console.table(
    ranked.map((r) => ({
      fixed_host: r.getResultByName("fixed_host"),
      total_host_frecency: r.getResultByName("total_host_frecency"),
      any_recent_typed: r.getResultByName("any_recent_typed"),
      passes_threshold: r.getResultByName("total_host_frecency") >= threshold,
      variants: r.getResultByName("variants"),
    })),
  );

  // noai.duckduckgo.com typed-visit stats (last 90 days)
  const typedDDG = await db.execute(
    `SELECT p.rev_host, COUNT(*) AS typed_visits_90d,
                COUNT(DISTINCT CAST(v.visit_date / (86400 * 1000000) AS INTEGER)) AS typed_days_90d
         FROM moz_historyvisits v
         JOIN moz_places p ON p.id = v.place_id
         WHERE v.visit_type = 2
           AND v.visit_date > (strftime('%s','now') - 90*86400) * 1000000
           AND p.rev_host LIKE :ddg
         GROUP BY p.rev_host`,
    { ddg: "moc.ogkcudkcud.iaon.%" },
  );
  console.log("noai.duckduckgo.com typed visits (last 90 days):");
  console.table(
    typedDDG.map((r) => ({
      rev_host: r.getResultByName("rev_host"),
      typed_visits_90d: r.getResultByName("typed_visits_90d"),
      typed_days_90d: r.getResultByName("typed_days_90d"),
    })),
  );

  // news.google.com typed-visit stats (last 90 days)
  const typedGoogleNews = await db.execute(
    `SELECT p.rev_host, COUNT(*) AS typed_visits_90d,
                COUNT(DISTINCT CAST(v.visit_date / (86400 * 1000000) AS INTEGER)) AS typed_days_90d
         FROM moz_historyvisits v
         JOIN moz_places p ON p.id = v.place_id
         WHERE v.visit_type = 2
           AND v.visit_date > (strftime('%s','now') - 90*86400) * 1000000
           AND p.rev_host LIKE :news
         GROUP BY p.rev_host`,
    { news: "moc.elgoog.swen.%" },
  );
  console.log("news.google.com typed visits (last 90 days):");
  console.table(
    typedGoogleNews.map((r) => ({
      rev_host: r.getResultByName("rev_host"),
      typed_visits_90d: r.getResultByName("typed_visits_90d"),
      typed_days_90d: r.getResultByName("typed_days_90d"),
    })),
  );
})();

I've enclose a sample output of what it looks like.

(In reply to Marco Bonardo [:mak] from comment #1)

While the behavior differs, this is not necessarily a problem as it's not based on the absolute number of visits.
Was this before or after our improvements to use number of typed?

It should be after since the user is on 150 but we landed the typed changes in 149.

Hi, chiming in - I'll try to put it in layman's terms to maybe address the real problem which is users got muscle memory for tapping the address bar and immediately seeing their most used web sites. From the little I understand in the comments above, the attempt is to fine tune the suggestions but right now it's so way off that maybe fine tuning would not address what people are accustomed to.

The desired behavior that's missing is the list that when tapping the address bar the list would be similar to that shown by typing "^" (History). That list is gone. Even if I disable everything but "Browsing History" in the address bar, nothing shows up.

If frecency is made right, one should see their common web sites surfaced. In 150 it's still way off. In my case, despite browsing FB, YouTube and news sites with GREAT frequency (admittedly too much...) - it still shows irrelevant, random web sites.

This is a real drag that's been going on since 147 and is a major quality of life bug. Maybe add some flag in the meantime that can bring the "^" behavior by default on tapping the address bar?

Thank you for your work, I hope this gets resolved soon.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: