OLD | NEW |
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 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 }; | 96 }; |
97 | 97 |
98 // This class manages the Omnibox field trials. | 98 // This class manages the Omnibox field trials. |
99 class OmniboxFieldTrial { | 99 class OmniboxFieldTrial { |
100 public: | 100 public: |
101 // A mapping that contains multipliers indicating that matches of the | 101 // A mapping that contains multipliers indicating that matches of the |
102 // specified type should have their relevance score multiplied by the | 102 // specified type should have their relevance score multiplied by the |
103 // given number. Omitted types are assumed to have multipliers of 1.0. | 103 // given number. Omitted types are assumed to have multipliers of 1.0. |
104 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers; | 104 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers; |
105 | 105 |
| 106 // A vector that maps from the number of matching pages to the document |
| 107 // specificity score used in HistoryQuick provider / ScoredHistoryMatch |
| 108 // scoring. The vector is sorted by the size_t (the number of matching pages). |
| 109 // If an entry is omitted, the appropriate value is assumed to be the one in |
| 110 // the later bucket. For example, with a vector containing {{1, 2.0}, |
| 111 // {3, 1.5}}, the score for 2 is inferred to be 1.5. Values beyond the |
| 112 // end of the vector are assumed to have scores of 1.0. |
| 113 typedef std::vector<std::pair<size_t, double>> NumMatchesScores; |
| 114 |
106 // Do not change these values as they need to be in sync with values | 115 // Do not change these values as they need to be in sync with values |
107 // specified in experiment configs on the variations server. | 116 // specified in experiment configs on the variations server. |
108 enum EmphasizeTitlesCondition { | 117 enum EmphasizeTitlesCondition { |
109 EMPHASIZE_WHEN_NONEMPTY = 0, | 118 EMPHASIZE_WHEN_NONEMPTY = 0, |
110 EMPHASIZE_WHEN_TITLE_MATCHES = 1, | 119 EMPHASIZE_WHEN_TITLE_MATCHES = 1, |
111 EMPHASIZE_WHEN_ONLY_TITLE_MATCHES = 2, | 120 EMPHASIZE_WHEN_ONLY_TITLE_MATCHES = 2, |
112 EMPHASIZE_NEVER = 3 | 121 EMPHASIZE_NEVER = 3 |
113 }; | 122 }; |
114 | 123 |
115 // --------------------------------------------------------- | 124 // --------------------------------------------------------- |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 static bool HQPFreqencyUsesSum(); | 304 static bool HQPFreqencyUsesSum(); |
296 | 305 |
297 // Returns the number of visits HQP should use when computing frequency | 306 // Returns the number of visits HQP should use when computing frequency |
298 // scores. Returns 10 if the epxeriment isn't active. | 307 // scores. Returns 10 if the epxeriment isn't active. |
299 static size_t HQPMaxVisitsToScore(); | 308 static size_t HQPMaxVisitsToScore(); |
300 | 309 |
301 // Returns the score that should be given to typed transitions. (The score | 310 // Returns the score that should be given to typed transitions. (The score |
302 // of non-typed transitions is 1.) Returns 20 if the experiment isn't active. | 311 // of non-typed transitions is 1.) Returns 20 if the experiment isn't active. |
303 static float HQPTypedValue(); | 312 static float HQPTypedValue(); |
304 | 313 |
| 314 // Returns NumMatchesScores; see comment by the declaration of it. |
| 315 // Returns an empty NumMatchesScores if the experiment isn't active. |
| 316 static NumMatchesScores HQPNumMatchesScores(); |
| 317 |
305 // --------------------------------------------------------- | 318 // --------------------------------------------------------- |
306 // For the HQPNumTitleWords experiment that's part of the | 319 // For the HQPNumTitleWords experiment that's part of the |
307 // bundled omnibox field trial. | 320 // bundled omnibox field trial. |
308 | 321 |
309 // Returns the number of title words that are allowed to contribute | 322 // Returns the number of title words that are allowed to contribute |
310 // to the topicality score. Words later in the title are ignored. | 323 // to the topicality score. Words later in the title are ignored. |
311 // Returns 20 as a default if the experiment isn't active. | 324 // Returns 20 as a default if the experiment isn't active. |
312 static size_t HQPNumTitleWordsToAllow(); | 325 static size_t HQPNumTitleWordsToAllow(); |
313 | 326 |
314 // --------------------------------------------------------- | 327 // --------------------------------------------------------- |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 static const char kHQPAllowMatchInSchemeRule[]; | 388 static const char kHQPAllowMatchInSchemeRule[]; |
376 static const char kZeroSuggestRule[]; | 389 static const char kZeroSuggestRule[]; |
377 static const char kZeroSuggestVariantRule[]; | 390 static const char kZeroSuggestVariantRule[]; |
378 static const char kSuggestVariantRule[]; | 391 static const char kSuggestVariantRule[]; |
379 static const char kDisableResultsCachingRule[]; | 392 static const char kDisableResultsCachingRule[]; |
380 static const char kMeasureSuggestPollingDelayFromLastKeystrokeRule[]; | 393 static const char kMeasureSuggestPollingDelayFromLastKeystrokeRule[]; |
381 static const char kSuggestPollingDelayMsRule[]; | 394 static const char kSuggestPollingDelayMsRule[]; |
382 static const char kHQPFixFewVisitsBugRule[]; | 395 static const char kHQPFixFewVisitsBugRule[]; |
383 static const char kHQPFreqencyUsesSumRule[]; | 396 static const char kHQPFreqencyUsesSumRule[]; |
384 static const char kHQPMaxVisitsToScoreRule[]; | 397 static const char kHQPMaxVisitsToScoreRule[]; |
| 398 static const char kHQPNumMatchesScoresRule[]; |
385 static const char kHQPNumTitleWordsRule[]; | 399 static const char kHQPNumTitleWordsRule[]; |
386 static const char kHQPAlsoDoHUPLikeScoringRule[]; | 400 static const char kHQPAlsoDoHUPLikeScoringRule[]; |
387 static const char kHUPSearchDatabaseRule[]; | 401 static const char kHUPSearchDatabaseRule[]; |
388 static const char kPreventUWYTDefaultForNonURLInputsRule[]; | 402 static const char kPreventUWYTDefaultForNonURLInputsRule[]; |
389 static const char kKeywordRequiresRegistryRule[]; | 403 static const char kKeywordRequiresRegistryRule[]; |
390 static const char kKeywordRequiresPrefixMatchRule[]; | 404 static const char kKeywordRequiresPrefixMatchRule[]; |
391 static const char kKeywordScoreForSufficientlyCompleteMatchRule[]; | 405 static const char kKeywordScoreForSufficientlyCompleteMatchRule[]; |
392 static const char kHQPAllowDupMatchesForScoringRule[]; | 406 static const char kHQPAllowDupMatchesForScoringRule[]; |
393 static const char kEmphasizeTitlesRule[]; | 407 static const char kEmphasizeTitlesRule[]; |
394 | 408 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 // prioritize different wildcard contexts, see the implementation. How to | 445 // prioritize different wildcard contexts, see the implementation. How to |
432 // interpret the value is left to the caller; this is rule-dependent. | 446 // interpret the value is left to the caller; this is rule-dependent. |
433 static std::string GetValueForRuleInContext( | 447 static std::string GetValueForRuleInContext( |
434 const std::string& rule, | 448 const std::string& rule, |
435 metrics::OmniboxEventProto::PageClassification page_classification); | 449 metrics::OmniboxEventProto::PageClassification page_classification); |
436 | 450 |
437 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 451 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
438 }; | 452 }; |
439 | 453 |
440 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 454 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
OLD | NEW |