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

Side by Side Diff: components/omnibox/omnibox_field_trial.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 unified diff | Download patch
« no previous file with comments | « components/omnibox/omnibox_field_trial.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 double topicality_threshold;
317 if (!base::StringToDouble(topicality_threhold_str, &topicality_threshold))
318 return -1;
319
320 return static_cast<float>(topicality_threshold);
321 }
322
323 bool OmniboxFieldTrial::HQPAllowMatchInTLDValue() { 292 bool OmniboxFieldTrial::HQPAllowMatchInTLDValue() {
324 return variations::GetVariationParamValue( 293 return variations::GetVariationParamValue(
325 kBundledExperimentFieldTrialName, 294 kBundledExperimentFieldTrialName,
326 kHQPAllowMatchInTLDRule) == "true"; 295 kHQPAllowMatchInTLDRule) == "true";
327 } 296 }
328 297
329 bool OmniboxFieldTrial::HQPAllowMatchInSchemeValue() { 298 bool OmniboxFieldTrial::HQPAllowMatchInSchemeValue() {
330 return variations::GetVariationParamValue( 299 return variations::GetVariationParamValue(
331 kBundledExperimentFieldTrialName, 300 kBundledExperimentFieldTrialName,
332 kHQPAllowMatchInSchemeRule) == "true"; 301 kHQPAllowMatchInSchemeRule) == "true";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 const std::string& polling_delay_string = variations::GetVariationParamValue( 334 const std::string& polling_delay_string = variations::GetVariationParamValue(
366 kBundledExperimentFieldTrialName, 335 kBundledExperimentFieldTrialName,
367 kSuggestPollingDelayMsRule); 336 kSuggestPollingDelayMsRule);
368 if (polling_delay_string.empty() || 337 if (polling_delay_string.empty() ||
369 !base::StringToInt(polling_delay_string, polling_delay_ms) || 338 !base::StringToInt(polling_delay_string, polling_delay_ms) ||
370 (*polling_delay_ms <= 0)) { 339 (*polling_delay_ms <= 0)) {
371 *polling_delay_ms = kDefaultMinimumTimeBetweenSuggestQueriesMs; 340 *polling_delay_ms = kDefaultMinimumTimeBetweenSuggestQueriesMs;
372 } 341 }
373 } 342 }
374 343
344 bool OmniboxFieldTrial::HQPExperimentalScoringEnabled() {
345 return variations::GetVariationParamValue(
346 kBundledExperimentFieldTrialName,
347 kHQPExperimentalScoringEnabledParam) == "true";
348 }
349
350 std::string OmniboxFieldTrial::HQPExperimentalScoringBuckets() {
351 if (!HQPExperimentalScoringEnabled())
352 return "";
353
354 return variations::GetVariationParamValue(
355 kBundledExperimentFieldTrialName,
356 kHQPExperimentalScoringBucketsParam);
357 }
358
359 float OmniboxFieldTrial::HQPExperimentalTopicalityThreshold() {
360 if (!HQPExperimentalScoringEnabled())
361 return -1;
362
363 std::string topicality_threhold_str =
364 variations::GetVariationParamValue(
365 kBundledExperimentFieldTrialName,
366 kHQPExperimentalScoringTopicalityThresholdParam);
367
368 double topicality_threshold;
369 if (!base::StringToDouble(topicality_threhold_str, &topicality_threshold))
370 return -1;
371
372 return static_cast<float>(topicality_threshold);
373 }
374
375 bool OmniboxFieldTrial::HQPFixFrequencyScoringBugs() {
376 return variations::GetVariationParamValue(
377 kBundledExperimentFieldTrialName,
378 kHQPFixFrequencyScoringBugsRule) == "true";
379 }
380
375 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] = 381 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] =
376 "OmniboxBundledExperimentV1"; 382 "OmniboxBundledExperimentV1";
377 const char OmniboxFieldTrial::kDisableProvidersRule[] = "DisableProviders"; 383 const char OmniboxFieldTrial::kDisableProvidersRule[] = "DisableProviders";
378 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = 384 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] =
379 "ShortcutsScoringMaxRelevance"; 385 "ShortcutsScoringMaxRelevance";
380 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; 386 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory";
381 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; 387 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType";
382 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = 388 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] =
383 "HQPBookmarkValue"; 389 "HQPBookmarkValue";
384 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; 390 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD";
385 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = 391 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] =
386 "HQPAllowMatchInScheme"; 392 "HQPAllowMatchInScheme";
387 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; 393 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest";
388 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; 394 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant";
389 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; 395 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest";
390 const char OmniboxFieldTrial::kDisplayHintTextWhenPossibleRule[] = 396 const char OmniboxFieldTrial::kDisplayHintTextWhenPossibleRule[] =
391 "DisplayHintTextWhenPossible"; 397 "DisplayHintTextWhenPossible";
392 const char OmniboxFieldTrial::kDisableResultsCachingRule[] = 398 const char OmniboxFieldTrial::kDisableResultsCachingRule[] =
393 "DisableResultsCaching"; 399 "DisableResultsCaching";
394 const char 400 const char
395 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] = 401 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] =
396 "MeasureSuggestPollingDelayFromLastKeystroke"; 402 "MeasureSuggestPollingDelayFromLastKeystroke";
397 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = 403 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] =
398 "SuggestPollingDelayMs"; 404 "SuggestPollingDelayMs";
405 const char OmniboxFieldTrial::kHQPFixFrequencyScoringBugsRule[] =
406 "HQPFixFrequencyScoringBugs";
399 407
400 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = 408 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] =
401 "HUPExperimentalScoringEnabled"; 409 "HUPExperimentalScoringEnabled";
402 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] = 410 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] =
403 "TypedCountRelevanceCap"; 411 "TypedCountRelevanceCap";
404 const char OmniboxFieldTrial::kHUPNewScoringTypedCountHalfLifeTimeParam[] = 412 const char OmniboxFieldTrial::kHUPNewScoringTypedCountHalfLifeTimeParam[] =
405 "TypedCountHalfLifeTime"; 413 "TypedCountHalfLifeTime";
406 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] = 414 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] =
407 "TypedCountScoreBuckets"; 415 "TypedCountScoreBuckets";
408 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] = 416 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] =
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 if (it != params.end()) 486 if (it != params.end())
479 return it->second; 487 return it->second;
480 // Fall back to the global instant extended context. 488 // Fall back to the global instant extended context.
481 it = params.find(rule + ":" + page_classification_str + ":*"); 489 it = params.find(rule + ":" + page_classification_str + ":*");
482 if (it != params.end()) 490 if (it != params.end())
483 return it->second; 491 return it->second;
484 // Look up rule in the global context. 492 // Look up rule in the global context.
485 it = params.find(rule + ":*:*"); 493 it = params.find(rule + ":*:*");
486 return (it != params.end()) ? it->second : std::string(); 494 return (it != params.end()) ? it->second : std::string();
487 } 495 }
OLDNEW
« no previous file with comments | « components/omnibox/omnibox_field_trial.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698