| 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
|
|
|