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

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

Issue 2541143002: Omnibox - Boost Frequency Scores Based on Number of Matching Pages (Closed)
Patch Set: remove setup/teardown test case code Created 4 years 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/omnibox_field_trial.cc
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc
index cbcf6f6c652608ac671e6122705442e1a3457401..4e95c6d6a51bd59ea0d6bacbf9ce37baf4cb02fd 100644
--- a/components/omnibox/browser/omnibox_field_trial.cc
+++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -443,6 +443,30 @@ float OmniboxFieldTrial::HQPTypedValue() {
return typed_value;
}
+void OmniboxFieldTrial::HQPGetNumMatchesMultipliers(
+ NumMatchesMultipliers* num_matches_multipliers) {
+ std::string str = variations::GetVariationParamValue(
+ kBundledExperimentFieldTrialName, kHQPNumMatchesMultipliersRule);
+ // The parameter is a comma-separated list of (number, value) pairs.
+ // e.g., "1:3,2:2.5,3:2,4:1.5"
Peter Kasting 2016/12/01 07:07:53 Super nitpicky nit: "pairs, e.g. "..."." (comma
Mark P 2016/12/04 01:06:41 Done.
+ // This is a best-effort conversion; we trust the hand-crafted parameters
+ // downloaded from the server to be perfect. There's no need for handle
Peter Kasting 2016/12/01 07:07:53 Nit: for -> to
Mark P 2016/12/04 01:06:41 Done.
+ // errors smartly.
+ base::StringPairs kv_pairs;
+ if (!base::SplitStringIntoKeyValuePairs(str, ':', ',', &kv_pairs))
+ return;
+ for (base::StringPairs::const_iterator it = kv_pairs.begin();
+ it != kv_pairs.end(); ++it) {
Peter Kasting 2016/12/01 07:07:53 Nit: Range-based for?
Mark P 2016/12/04 01:06:41 Now moot.
+ size_t num;
+ double multiplier;
+ base::StringToSizeT(it->first, &num);
+ base::StringToDouble(it->second, &multiplier);
+ DCHECK(num_matches_multipliers->find(num) ==
+ num_matches_multipliers->end());
Peter Kasting 2016/12/01 07:07:53 Nit: DCHECK(!base::ContainsKey(num_matches_multipl
Mark P 2016/12/04 01:06:41 Did something similar. (Between this duplicates-t
+ (*num_matches_multipliers)[num] = multiplier;
+ }
+}
+
size_t OmniboxFieldTrial::HQPNumTitleWordsToAllow() {
// The value of the rule is a string that encodes an integer (actually
// size_t) containing the number of words.
@@ -548,6 +572,8 @@ const char OmniboxFieldTrial::kHQPFixFewVisitsBugRule[] = "HQPFixFewVisitsBug";
const char OmniboxFieldTrial::kHQPFreqencyUsesSumRule[] = "HQPFreqencyUsesSum";
const char OmniboxFieldTrial::kHQPMaxVisitsToScoreRule[] =
"HQPMaxVisitsToScoreRule";
+const char OmniboxFieldTrial::kHQPNumMatchesMultipliersRule[] =
+ "HQPNumMatchesMultipliers";
const char OmniboxFieldTrial::kHQPNumTitleWordsRule[] = "HQPNumTitleWords";
const char OmniboxFieldTrial::kHQPAlsoDoHUPLikeScoringRule[] =
"HQPAlsoDoHUPLikeScoring";

Powered by Google App Engine
This is Rietveld 408576698