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

Side by Side Diff: components/omnibox/omnibox_field_trial.cc

Issue 905023003: Adding knobs on HQP provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fix. Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/omnibox/omnibox_field_trial.h" 5 #include "components/omnibox/omnibox_field_trial.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 if (bookmark_value_str.empty()) 282 if (bookmark_value_str.empty())
283 return 10; 283 return 10;
284 // This is a best-effort conversion; we trust the hand-crafted parameters 284 // This is a best-effort conversion; we trust the hand-crafted parameters
285 // downloaded from the server to be perfect. There's no need for handle 285 // downloaded from the server to be perfect. There's no need for handle
286 // errors smartly. 286 // errors smartly.
287 int bookmark_value; 287 int bookmark_value;
288 base::StringToInt(bookmark_value_str, &bookmark_value); 288 base::StringToInt(bookmark_value_str, &bookmark_value);
289 return bookmark_value; 289 return bookmark_value;
290 } 290 }
291 291
292 bool OmniboxFieldTrial::HQPExperimentalScoringEnabled() {
293 return variations::GetVariationParamValue(
294 kBundledExperimentFieldTrialName,
295 kHQPExperimentalScoringEnabledParam) == "true";
296 }
297
298 std::string OmniboxFieldTrial::HQPExperimentalScoringBuckets() {
299 if (!HQPExperimentalScoringEnabled())
300 return "";
301
302 return variations::GetVariationParamValue(
303 kBundledExperimentFieldTrialName,
304 kHQPExperimentalScoringBucketsParam);
305 }
306
307 float OmniboxFieldTrial::HQPExperimentalTopicalityThreshold() {
308 if (!HQPExperimentalScoringEnabled())
309 return -1;
310
311 std::string topicality_threhold_str =
312 variations::GetVariationParamValue(
313 kBundledExperimentFieldTrialName,
314 kHQPExperimentalScoringTopicalityThresholdParam);
315
316 if (topicality_threhold_str.empty())
317 return -1;
318
319 double topicality_threshold;
320 base::StringToDouble(topicality_threhold_str, &topicality_threshold);
Mark P 2015/02/11 21:57:30 You might as well use the return value
Ashok vardhan 2015/02/12 19:56:31 Done.
321 return static_cast<float>(topicality_threshold);
322 }
323
292 bool OmniboxFieldTrial::HQPAllowMatchInTLDValue() { 324 bool OmniboxFieldTrial::HQPAllowMatchInTLDValue() {
293 return variations::GetVariationParamValue( 325 return variations::GetVariationParamValue(
294 kBundledExperimentFieldTrialName, 326 kBundledExperimentFieldTrialName,
295 kHQPAllowMatchInTLDRule) == "true"; 327 kHQPAllowMatchInTLDRule) == "true";
296 } 328 }
297 329
298 bool OmniboxFieldTrial::HQPAllowMatchInSchemeValue() { 330 bool OmniboxFieldTrial::HQPAllowMatchInSchemeValue() {
299 return variations::GetVariationParamValue( 331 return variations::GetVariationParamValue(
300 kBundledExperimentFieldTrialName, 332 kBundledExperimentFieldTrialName,
301 kHQPAllowMatchInSchemeRule) == "true"; 333 kHQPAllowMatchInSchemeRule) == "true";
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 "TypedCountHalfLifeTime"; 406 "TypedCountHalfLifeTime";
375 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] = 407 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] =
376 "TypedCountScoreBuckets"; 408 "TypedCountScoreBuckets";
377 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] = 409 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] =
378 "VisitedCountRelevanceCap"; 410 "VisitedCountRelevanceCap";
379 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountHalfLifeTimeParam[] = 411 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountHalfLifeTimeParam[] =
380 "VisitedCountHalfLifeTime"; 412 "VisitedCountHalfLifeTime";
381 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountScoreBucketsParam[] = 413 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountScoreBucketsParam[] =
382 "VisitedCountScoreBuckets"; 414 "VisitedCountScoreBuckets";
383 415
416 const char OmniboxFieldTrial::kHQPExperimentalScoringEnabledParam[] =
417 "HQPExperimentalScoringEnabled";
418 const char OmniboxFieldTrial::kHQPExperimentalScoringBucketsParam[] =
419 "HQPExperimentalScoringBuckets";
420 const char
421 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] =
422 "HQPExperimentalScoringTopicalityThreshold";
423
384 // static 424 // static
385 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; 425 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100;
386 426
387 // Background and implementation details: 427 // Background and implementation details:
388 // 428 //
389 // Each experiment group in any field trial can come with an optional set of 429 // Each experiment group in any field trial can come with an optional set of
390 // parameters (key-value pairs). In the bundled omnibox experiment 430 // parameters (key-value pairs). In the bundled omnibox experiment
391 // (kBundledExperimentFieldTrialName), each experiment group comes with a 431 // (kBundledExperimentFieldTrialName), each experiment group comes with a
392 // list of parameters in the form: 432 // list of parameters in the form:
393 // key=<Rule>: 433 // key=<Rule>:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (it != params.end()) 479 if (it != params.end())
440 return it->second; 480 return it->second;
441 // Fall back to the global instant extended context. 481 // Fall back to the global instant extended context.
442 it = params.find(rule + ":" + page_classification_str + ":*"); 482 it = params.find(rule + ":" + page_classification_str + ":*");
443 if (it != params.end()) 483 if (it != params.end())
444 return it->second; 484 return it->second;
445 // Look up rule in the global context. 485 // Look up rule in the global context.
446 it = params.find(rule + ":*:*"); 486 it = params.find(rule + ":*:*");
447 return (it != params.end()) ? it->second : std::string(); 487 return (it != params.end()) ? it->second : std::string();
448 } 488 }
OLDNEW
« components/omnibox/omnibox_field_trial.h ('K') | « components/omnibox/omnibox_field_trial.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698