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

Unified Diff: chrome/browser/autocomplete/scored_history_match.cc

Issue 1009973005: Omnibox: Fix Scoring Bugs in URLs from History (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 5 years, 9 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
« no previous file with comments | « chrome/browser/autocomplete/scored_history_match.h ('k') | components/omnibox/omnibox_field_trial.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/scored_history_match.cc
diff --git a/chrome/browser/autocomplete/scored_history_match.cc b/chrome/browser/autocomplete/scored_history_match.cc
index 50b9d2b2dba56aeb549da88adca3408464c43d82..297ff6c5546b43306ad875cdfed81e7618a6a20b 100644
--- a/chrome/browser/autocomplete/scored_history_match.cc
+++ b/chrome/browser/autocomplete/scored_history_match.cc
@@ -123,6 +123,7 @@ void InitDaysAgoToRecencyScoreArray() {
// static
const size_t ScoredHistoryMatch::kMaxVisitsToScore = 10;
int ScoredHistoryMatch::bookmark_value_ = 1;
+bool ScoredHistoryMatch::fix_frequency_bugs_ = false;
bool ScoredHistoryMatch::allow_tld_matches_ = false;
bool ScoredHistoryMatch::allow_scheme_matches_ = false;
bool ScoredHistoryMatch::hqp_experimental_scoring_enabled_ = false;
@@ -404,6 +405,7 @@ void ScoredHistoryMatch::Init() {
HistoryURLProvider::kScoreForBestInlineableResult - 1;
}
bookmark_value_ = OmniboxFieldTrial::HQPBookmarkValue();
+ fix_frequency_bugs_ = OmniboxFieldTrial::HQPFixFrequencyScoringBugs();
allow_tld_matches_ = OmniboxFieldTrial::HQPAllowMatchInTLDValue();
allow_scheme_matches_ = OmniboxFieldTrial::HQPAllowMatchInSchemeValue();
@@ -583,16 +585,20 @@ float ScoredHistoryMatch::GetFrequency(const base::Time& now,
const size_t max_visit_to_score =
std::min(visits.size(), ScoredHistoryMatch::kMaxVisitsToScore);
for (size_t i = 0; i < max_visit_to_score; ++i) {
- int value_of_transition =
- (visits[i].second == ui::PAGE_TRANSITION_TYPED) ? 20 : 1;
+ const bool typed_visit = fix_frequency_bugs_ ?
+ (visits[i].second & ui::PAGE_TRANSITION_TYPED) :
+ (visits[i].second == ui::PAGE_TRANSITION_TYPED);
+ int value_of_transition = typed_visit ? 20 : 1;
if (bookmarked)
value_of_transition = std::max(value_of_transition, bookmark_value_);
const float bucket_weight =
GetRecencyScore((now - visits[i].first).InDays());
summed_visit_points += (value_of_transition * bucket_weight);
}
+ if (fix_frequency_bugs_)
+ return summed_visit_points / ScoredHistoryMatch::kMaxVisitsToScore;
return visits.size() * summed_visit_points /
- ScoredHistoryMatch::kMaxVisitsToScore;
+ ScoredHistoryMatch::kMaxVisitsToScore;
}
// static
« no previous file with comments | « chrome/browser/autocomplete/scored_history_match.h ('k') | components/omnibox/omnibox_field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698