Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an API to get the top frecent sites #3144

Merged
merged 1 commit into from
May 29, 2020
Merged

Add an API to get the top frecent sites #3144

merged 1 commit into from
May 29, 2020

Conversation

gabrielluong
Copy link
Member

@gabrielluong gabrielluong commented May 22, 2020

Fixes #2163

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • automation/all_tests.sh runs to completion and produces no failures
    • Note: For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGES_UNRELEASED.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

@gabrielluong gabrielluong changed the title Add an API to get the top frecent sites [WIP] Add an API to get the top frecent sites May 22, 2020
@gabrielluong gabrielluong changed the title [WIP] Add an API to get the top frecent sites Add an API to get the top frecent sites May 24, 2020
@gabrielluong
Copy link
Member Author

gabrielluong commented May 25, 2020

@linacambridge This should be ready for review. I don't have permissions to request reviews.

@mhammond
Copy link
Member

A bit of a drive-by - I don't think the name topSiteFrecency is very descriptive - I had no idea what it meant when first reading this. More generally though, I'm not sure it makes sense to have this as part of the API - I don't think we want consumers of this API to try and understand what an absolute frecency value actually means - ie, the number should be seen as only relative to other frecencies (ie, more or less frecent than another site) but not that, say "anything under X isn't frecent" or "anything over X is very frecent"

@gabrielluong
Copy link
Member Author

gabrielluong commented May 25, 2020

A bit of a drive-by - I don't think the name topSiteFrecency is very descriptive - I had no idea what it meant when first reading this. More generally though, I'm not sure it makes sense to have this as part of the API - I don't think we want consumers of this API to try and understand what an absolute frecency value actually means - ie, the number should be seen as only relative to other frecencies (ie, more or less frecent than another site) but not that, say "anything under X isn't frecent" or "anything over X is very frecent"

Totally understandable. Some of the options and naming that were used here originated from prior art of NewTabUtils.jsm#getTopFrecentSites https://searchfox.org/mozilla-central/rev/fc91a093e40dde71d10ad219946b8ae775aca9eb/toolkit/modules/NewTabUtils.jsm#1279-1284,1367-1390.

I don't personally feel too strongly about adding this as part of the API. My main concern was that getTopFrecentSites would start returning the first visited site you go to on a fresh profile of Fenix. Adding topSiteFrecency or perhaps better named frecencyThreshold provided some flexibility to avoid that.

Let me know if this additional information changes your thoughts on the API, happy to make any changes to it and get some additional eyes on this APi. Thanks!

@mhammond
Copy link
Member

My main concern was that getTopFrecentSites would start returning the first visited site you go to on a fresh profile of Fenix.

My main concern is that if Fenix starts specifying a frecency of (say) 200 to avoid this problem, it means we will be largely unable to ever change the algorithm - and we certainly want to reserve the right to change it (eg, see #610)

Indeed, this would argue for never actually returning the frecency - if we return the value it's inevitable that it will end up with meaning. I wonder if we should just return the order?

While I don't see that behaviour on a fresh profile as an actual problem, if we really do want to prevent that, I guess there are a couple of options:

  • Use something like (local/remote) visit count as a proxy - eg, maybe a site must be visited twice to qualify? But even this is subtle - something visited twice by following a link isn't necessarily "better" than a site visited once because the user explicitly typed the address. Similarly, the site having 1 visit but being bookmarked probably means it should be returned.

  • Have the implementation handle it internally - ie, still filter, but filter internally without the app having the ability to control the threshold. Given how subtle frecency is, this seems the best option, but it does remove flexibility from the containing app.

@lina probably has opinions here and I'll be happy to defer to them, so let's see what she says tomorrow.

@eoger eoger requested a review from linabutler May 29, 2020 16:06
linabutler
linabutler previously approved these changes May 29, 2020
Copy link
Member

@linabutler linabutler left a comment

Choose a reason for hiding this comment

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

This looks great, modulo comments about hiding the frecency threshold param. Thanks so much for working on this, @gabrielluong!

@gabrielluong
Copy link
Member Author

Thanks for the reviews and comments. I will make the changes to remove the frecency params before asking for this to land.

@mergify mergify bot dismissed linabutler’s stale review May 29, 2020 23:40

The pull request has been modified, dismissing previous reviews.

Copy link
Member

@linabutler linabutler left a comment

Choose a reason for hiding this comment

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

:shipit:

@gabrielluong gabrielluong added the checkin-needed Auto-merge this PR if there's an approved review and CI passes label May 29, 2020
@mergify mergify bot merged commit 0ad43db into mozilla:master May 29, 2020
@gabrielluong gabrielluong deleted the 2163 branch May 29, 2020 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checkin-needed Auto-merge this PR if there's an approved review and CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an API to fetch history pages for top sites
3 participants