Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1484)

Unified Diff: components/omnibox/browser/history_url_provider.cc

Issue 1286093006: Launch HQP & HUP score changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/history_url_provider.cc
diff --git a/components/omnibox/browser/history_url_provider.cc b/components/omnibox/browser/history_url_provider.cc
index 3ad59b5e569fab2814e5f9b735423048612e3536..1757bf688472c18fdc91c8d2d64c37f77c61f1c0 100644
--- a/components/omnibox/browser/history_url_provider.cc
+++ b/components/omnibox/browser/history_url_provider.cc
@@ -114,23 +114,25 @@ double CalculateRelevanceUsingScoreBuckets(
const HUPScoringParams::ScoreBuckets& score_buckets,
const base::TimeDelta& time_since_last_visit,
int undecayed_relevance,
- int count) {
+ int undecayed_count) {
// Back off if above relevance cap.
if ((score_buckets.relevance_cap() != -1) &&
(undecayed_relevance >= score_buckets.relevance_cap()))
return undecayed_relevance;
// Time based decay using half-life time.
- double decayed_count = count;
+ double decayed_count = undecayed_count;
+ double decay_factor = score_buckets.HalfLifeTimeDecay(time_since_last_visit);
if (decayed_count > 0)
- decayed_count *= score_buckets.HalfLifeTimeDecay(time_since_last_visit);
+ decayed_count *= decay_factor;
- // Find a threshold where decayed_count >= bucket.
const HUPScoringParams::ScoreBuckets::CountMaxRelevance* score_bucket = NULL;
+ const double factor = (score_buckets.use_decay_factor() ?
+ decay_factor : decayed_count);
for (size_t i = 0; i < score_buckets.buckets().size(); ++i) {
score_bucket = &score_buckets.buckets()[i];
- if (decayed_count >= score_bucket->first)
- break; // Buckets are in descending order, so we can ignore the rest.
+ if (factor >= score_bucket->first)
+ break;
}
return (score_bucket && (undecayed_relevance > score_bucket->second)) ?
@@ -146,9 +148,6 @@ int CalculateRelevanceScoreUsingScoringParams(
const history::HistoryMatch& match,
int old_relevance,
const HUPScoringParams& scoring_params) {
- if (!scoring_params.experimental_scoring_enabled)
- return old_relevance;
-
const base::TimeDelta time_since_last_visit =
base::Time::Now() - match.url_info.last_visit();
@@ -463,6 +462,8 @@ HistoryURLProvider::HistoryURLProvider(AutocompleteProviderClient* client,
: HistoryProvider(AutocompleteProvider::TYPE_HISTORY_URL, client),
listener_(listener),
params_(NULL) {
+ // Initialize the default HUP scoring params.
+ OmniboxFieldTrial::GetDefaultHUPScoringParams(&scoring_params_);
// Initialize HUP scoring params based on the current experiment.
OmniboxFieldTrial::GetExperimentalHUPScoringParams(&scoring_params_);
}
« no previous file with comments | « chrome/browser/autocomplete/in_memory_url_index_unittest.cc ('k') | components/omnibox/browser/omnibox_field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698