1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/omnibox/omnibox_field_trial.h"
10 #include "base/metrics/field_trial.h"
11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h"
15 #include "base/time/time.h"
16 #include "chrome/browser/autocomplete/autocomplete_input.h"
17 #include "chrome/browser/search/search.h"
18 #include "chrome/common/metrics/variations/variation_ids.h"
19 #include "chrome/common/metrics/variations/variations_util.h"
20 #include "components/variations/metrics_util.h"
24 typedef std::map
<std::string
, std::string
> VariationParams
;
25 typedef HUPScoringParams::ScoreBuckets ScoreBuckets
;
28 const char kHUPCullRedirectsFieldTrialName
[] = "OmniboxHUPCullRedirects";
29 const char kHUPCreateShorterMatchFieldTrialName
[] =
30 "OmniboxHUPCreateShorterMatch";
31 const char kStopTimerFieldTrialName
[] = "OmniboxStopTimer";
33 // In dynamic field trials, we use these group names to switch between
34 // different zero suggest implementations.
35 const char kEnableZeroSuggestGroupPrefix
[] = "EnableZeroSuggest";
36 const char kEnableZeroSuggestMostVisitedGroupPrefix
[] =
37 "EnableZeroSuggestMostVisited";
38 const char kEnableZeroSuggestAfterTypingGroupPrefix
[] =
39 "EnableZeroSuggestAfterTyping";
40 const char kEnableZeroSuggestPersonalizedGroupPrefix
[] =
41 "EnableZeroSuggestPersonalized";
43 // The autocomplete dynamic field trial name prefix. Each field trial is
44 // configured dynamically and is retrieved automatically by Chrome during
46 const char kAutocompleteDynamicFieldTrialPrefix
[] = "AutocompleteDynamicTrial_";
47 // The maximum number of the autocomplete dynamic field trials (aka layers).
48 const int kMaxAutocompleteDynamicFieldTrials
= 5;
50 // Field trial experiment probabilities.
52 // For HistoryURL provider cull redirects field trial, put 0% ( = 0/100 )
53 // of the users in the don't-cull-redirects experiment group.
54 // TODO(mpearson): Remove this field trial and the code it uses once I'm
55 // sure it's no longer needed.
56 const base::FieldTrial::Probability kHUPCullRedirectsFieldTrialDivisor
= 100;
57 const base::FieldTrial::Probability
58 kHUPCullRedirectsFieldTrialExperimentFraction
= 0;
60 // For HistoryURL provider create shorter match field trial, put 0%
61 // ( = 25/100 ) of the users in the don't-create-a-shorter-match
63 // TODO(mpearson): Remove this field trial and the code it uses once I'm
64 // sure it's no longer needed.
65 const base::FieldTrial::Probability
66 kHUPCreateShorterMatchFieldTrialDivisor
= 100;
67 const base::FieldTrial::Probability
68 kHUPCreateShorterMatchFieldTrialExperimentFraction
= 0;
71 // Though they are not literally "const", they are set only once, in
72 // ActivateStaticTrials() below.
74 // Whether the static field trials have been initialized by
75 // ActivateStaticTrials() method.
76 bool static_field_trials_initialized
= false;
78 // Field trial ID for the HistoryURL provider cull redirects experiment group.
79 int hup_dont_cull_redirects_experiment_group
= 0;
81 // Field trial ID for the HistoryURL provider create shorter match
83 int hup_dont_create_shorter_match_experiment_group
= 0;
86 // Concatenates the autocomplete dynamic field trial prefix with a field trial
87 // ID to form a complete autocomplete field trial name.
88 std::string
DynamicFieldTrialName(int id
) {
89 return base::StringPrintf("%s%d", kAutocompleteDynamicFieldTrialPrefix
, id
);
92 void InitializeScoreBuckets(const VariationParams
& params
,
93 const char* relevance_cap_param
,
94 const char* half_life_param
,
95 const char* score_buckets_param
,
96 ScoreBuckets
* score_buckets
) {
97 VariationParams::const_iterator it
= params
.find(relevance_cap_param
);
98 if (it
!= params
.end()) {
100 if (base::StringToInt(it
->second
, &relevance_cap
))
101 score_buckets
->set_relevance_cap(relevance_cap
);
104 it
= params
.find(half_life_param
);
105 if (it
!= params
.end()) {
107 if (base::StringToInt(it
->second
, &half_life_days
))
108 score_buckets
->set_half_life_days(half_life_days
);
111 it
= params
.find(score_buckets_param
);
112 if (it
!= params
.end()) {
113 // The value of the score bucket is a comma-separated list of
114 // {DecayedCount + ":" + MaxRelevance}.
115 base::StringPairs kv_pairs
;
116 if (base::SplitStringIntoKeyValuePairs(it
->second
, ':', ',', &kv_pairs
)) {
117 for (base::StringPairs::const_iterator it
= kv_pairs
.begin();
118 it
!= kv_pairs
.end(); ++it
) {
119 ScoreBuckets::CountMaxRelevance bucket
;
120 base::StringToDouble(it
->first
, &bucket
.first
);
121 base::StringToInt(it
->second
, &bucket
.second
);
122 score_buckets
->buckets().push_back(bucket
);
124 std::sort(score_buckets
->buckets().begin(),
125 score_buckets
->buckets().end(),
126 std::greater
<ScoreBuckets::CountMaxRelevance
>());
133 HUPScoringParams::ScoreBuckets::ScoreBuckets()
134 : relevance_cap_(-1),
135 half_life_days_(-1) {
138 HUPScoringParams::ScoreBuckets::~ScoreBuckets() {
141 double HUPScoringParams::ScoreBuckets::HalfLifeTimeDecay(
142 const base::TimeDelta
& elapsed_time
) const {
144 if ((half_life_days_
<= 0) ||
145 ((time_ms
= elapsed_time
.InMillisecondsF()) <= 0))
148 const double half_life_intervals
=
149 time_ms
/ base::TimeDelta::FromDays(half_life_days_
).InMillisecondsF();
150 return pow(2.0, -half_life_intervals
);
153 void OmniboxFieldTrial::ActivateStaticTrials() {
154 DCHECK(!static_field_trials_initialized
);
156 // Create the HistoryURL provider cull redirects field trial.
157 // Make it expire on March 1, 2013.
158 scoped_refptr
<base::FieldTrial
> trial(
159 base::FieldTrialList::FactoryGetFieldTrial(
160 kHUPCullRedirectsFieldTrialName
, kHUPCullRedirectsFieldTrialDivisor
,
161 "Standard", 2013, 3, 1, base::FieldTrial::ONE_TIME_RANDOMIZED
, NULL
));
162 hup_dont_cull_redirects_experiment_group
=
163 trial
->AppendGroup("DontCullRedirects",
164 kHUPCullRedirectsFieldTrialExperimentFraction
);
166 // Create the HistoryURL provider create shorter match field trial.
167 // Make it expire on March 1, 2013.
168 trial
= base::FieldTrialList::FactoryGetFieldTrial(
169 kHUPCreateShorterMatchFieldTrialName
,
170 kHUPCreateShorterMatchFieldTrialDivisor
, "Standard", 2013, 3, 1,
171 base::FieldTrial::ONE_TIME_RANDOMIZED
, NULL
);
172 hup_dont_create_shorter_match_experiment_group
=
173 trial
->AppendGroup("DontCreateShorterMatch",
174 kHUPCreateShorterMatchFieldTrialExperimentFraction
);
176 static_field_trials_initialized
= true;
179 void OmniboxFieldTrial::ActivateDynamicTrials() {
180 // Initialize all autocomplete dynamic field trials. This method may be
181 // called multiple times.
182 for (int i
= 0; i
< kMaxAutocompleteDynamicFieldTrials
; ++i
)
183 base::FieldTrialList::FindValue(DynamicFieldTrialName(i
));
186 int OmniboxFieldTrial::GetDisabledProviderTypes() {
187 // Make sure that Autocomplete dynamic field trials are activated. It's OK to
188 // call this method multiple times.
189 ActivateDynamicTrials();
191 // Look for group names in form of "DisabledProviders_<mask>" where "mask"
192 // is a bitmap of disabled provider types (AutocompleteProvider::Type).
193 int provider_types
= 0;
194 for (int i
= 0; i
< kMaxAutocompleteDynamicFieldTrials
; ++i
) {
195 std::string group_name
= base::FieldTrialList::FindFullName(
196 DynamicFieldTrialName(i
));
197 const char kDisabledProviders
[] = "DisabledProviders_";
198 if (!StartsWithASCII(group_name
, kDisabledProviders
, true))
201 if (!base::StringToInt(base::StringPiece(
202 group_name
.substr(strlen(kDisabledProviders
))), &types
))
204 provider_types
|= types
;
206 return provider_types
;
209 void OmniboxFieldTrial::GetActiveSuggestFieldTrialHashes(
210 std::vector
<uint32
>* field_trial_hashes
) {
211 field_trial_hashes
->clear();
212 for (int i
= 0; i
< kMaxAutocompleteDynamicFieldTrials
; ++i
) {
213 const std::string
& trial_name
= DynamicFieldTrialName(i
);
214 if (base::FieldTrialList::TrialExists(trial_name
))
215 field_trial_hashes
->push_back(metrics::HashName(trial_name
));
217 if (base::FieldTrialList::TrialExists(kBundledExperimentFieldTrialName
)) {
218 field_trial_hashes
->push_back(
219 metrics::HashName(kBundledExperimentFieldTrialName
));
223 bool OmniboxFieldTrial::InHUPCullRedirectsFieldTrial() {
224 return base::FieldTrialList::TrialExists(kHUPCullRedirectsFieldTrialName
);
227 bool OmniboxFieldTrial::InHUPCullRedirectsFieldTrialExperimentGroup() {
228 if (!base::FieldTrialList::TrialExists(kHUPCullRedirectsFieldTrialName
))
231 // Return true if we're in the experiment group.
232 const int group
= base::FieldTrialList::FindValue(
233 kHUPCullRedirectsFieldTrialName
);
234 return group
== hup_dont_cull_redirects_experiment_group
;
237 bool OmniboxFieldTrial::InHUPCreateShorterMatchFieldTrial() {
239 base::FieldTrialList::TrialExists(kHUPCreateShorterMatchFieldTrialName
);
242 bool OmniboxFieldTrial::InHUPCreateShorterMatchFieldTrialExperimentGroup() {
243 if (!base::FieldTrialList::TrialExists(kHUPCreateShorterMatchFieldTrialName
))
246 // Return true if we're in the experiment group.
247 const int group
= base::FieldTrialList::FindValue(
248 kHUPCreateShorterMatchFieldTrialName
);
249 return group
== hup_dont_create_shorter_match_experiment_group
;
252 base::TimeDelta
OmniboxFieldTrial::StopTimerFieldTrialDuration() {
254 if (base::StringToInt(
255 base::FieldTrialList::FindFullName(kStopTimerFieldTrialName
),
257 return base::TimeDelta::FromMilliseconds(stop_timer_ms
);
258 return base::TimeDelta::FromMilliseconds(1500);
261 bool OmniboxFieldTrial::HasDynamicFieldTrialGroupPrefix(
262 const char* group_prefix
) {
263 // Make sure that Autocomplete dynamic field trials are activated. It's OK to
264 // call this method multiple times.
265 ActivateDynamicTrials();
267 // Look for group names starting with |group_prefix|.
268 for (int i
= 0; i
< kMaxAutocompleteDynamicFieldTrials
; ++i
) {
269 const std::string
& group_name
= base::FieldTrialList::FindFullName(
270 DynamicFieldTrialName(i
));
271 if (StartsWithASCII(group_name
, group_prefix
, true))
277 bool OmniboxFieldTrial::InZeroSuggestFieldTrial() {
278 return HasDynamicFieldTrialGroupPrefix(kEnableZeroSuggestGroupPrefix
) ||
279 chrome_variations::GetVariationParamValue(
280 kBundledExperimentFieldTrialName
, kZeroSuggestRule
) == "true";
283 bool OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial() {
284 return HasDynamicFieldTrialGroupPrefix(
285 kEnableZeroSuggestMostVisitedGroupPrefix
) ||
286 chrome_variations::GetVariationParamValue(
287 kBundledExperimentFieldTrialName
,
288 kZeroSuggestVariantRule
) == "MostVisited";
291 bool OmniboxFieldTrial::InZeroSuggestAfterTypingFieldTrial() {
292 return HasDynamicFieldTrialGroupPrefix(
293 kEnableZeroSuggestAfterTypingGroupPrefix
) ||
294 chrome_variations::GetVariationParamValue(
295 kBundledExperimentFieldTrialName
,
296 kZeroSuggestVariantRule
) == "AfterTyping";
299 bool OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial() {
300 return HasDynamicFieldTrialGroupPrefix(
301 kEnableZeroSuggestPersonalizedGroupPrefix
) ||
302 chrome_variations::GetVariationParamValue(
303 kBundledExperimentFieldTrialName
,
304 kZeroSuggestVariantRule
) == "Personalized";
307 bool OmniboxFieldTrial::ShortcutsScoringMaxRelevance(
308 AutocompleteInput::PageClassification current_page_classification
,
309 int* max_relevance
) {
310 // The value of the rule is a string that encodes an integer containing
311 // the max relevance.
312 const std::string
& max_relevance_str
=
313 OmniboxFieldTrial::GetValueForRuleInContext(
314 kShortcutsScoringMaxRelevanceRule
, current_page_classification
);
315 if (max_relevance_str
.empty())
317 if (!base::StringToInt(max_relevance_str
, max_relevance
))
322 bool OmniboxFieldTrial::SearchHistoryPreventInlining(
323 AutocompleteInput::PageClassification current_page_classification
) {
324 return OmniboxFieldTrial::GetValueForRuleInContext(
325 kSearchHistoryRule
, current_page_classification
) == "PreventInlining";
328 bool OmniboxFieldTrial::SearchHistoryDisable(
329 AutocompleteInput::PageClassification current_page_classification
) {
330 return OmniboxFieldTrial::GetValueForRuleInContext(
331 kSearchHistoryRule
, current_page_classification
) == "Disable";
334 void OmniboxFieldTrial::GetDemotionsByType(
335 AutocompleteInput::PageClassification current_page_classification
,
336 DemotionMultipliers
* demotions_by_type
) {
337 demotions_by_type
->clear();
338 std::string demotion_rule
= OmniboxFieldTrial::GetValueForRuleInContext(
339 kDemoteByTypeRule
, current_page_classification
);
340 // If there is no demotion rule for this context, then use the default
341 // value for that context. At the moment the default value is non-empty
342 // only for the fakebox-focus context.
343 if (demotion_rule
.empty() &&
344 (current_page_classification
==
345 AutocompleteInput::INSTANT_NTP_WITH_FAKEBOX_AS_STARTING_FOCUS
))
346 demotion_rule
= "1:61,2:61,3:61,4:61,12:61";
348 // The value of the DemoteByType rule is a comma-separated list of
349 // {ResultType + ":" + Number} where ResultType is an AutocompleteMatchType::
350 // Type enum represented as an integer and Number is an integer number
351 // between 0 and 100 inclusive. Relevance scores of matches of that result
352 // type are multiplied by Number / 100. 100 means no change.
353 base::StringPairs kv_pairs
;
354 if (base::SplitStringIntoKeyValuePairs(demotion_rule
, ':', ',', &kv_pairs
)) {
355 for (base::StringPairs::const_iterator it
= kv_pairs
.begin();
356 it
!= kv_pairs
.end(); ++it
) {
357 // This is a best-effort conversion; we trust the hand-crafted parameters
358 // downloaded from the server to be perfect. There's no need to handle
361 base::StringToInt(it
->first
, &k
);
362 base::StringToInt(it
->second
, &v
);
363 (*demotions_by_type
)[static_cast<AutocompleteMatchType::Type
>(k
)] =
364 static_cast<float>(v
) / 100.0f
;
369 OmniboxFieldTrial::UndemotableTopMatchTypes
370 OmniboxFieldTrial::GetUndemotableTopTypes(
371 AutocompleteInput::PageClassification current_page_classification
) {
372 UndemotableTopMatchTypes undemotable_types
;
373 const std::string types_rule
=
374 OmniboxFieldTrial::GetValueForRuleInContext(
375 kUndemotableTopTypeRule
,
376 current_page_classification
);
377 // The value of the UndemotableTopTypes rule is a comma-separated list of
378 // AutocompleteMatchType::Type enums represented as an integer. The
379 // DemoteByType rule does not apply to the top match if the type of the top
380 // match is in this list.
381 std::vector
<std::string
> types
;
382 base::SplitString(types_rule
, ',', &types
);
383 for (std::vector
<std::string
>::const_iterator it
= types
.begin();
384 it
!= types
.end(); ++it
) {
385 // This is a best-effort conversion; we trust the hand-crafted parameters
386 // downloaded from the server to be perfect. There's no need to handle
389 base::StringToInt(*it
, &t
);
390 undemotable_types
.insert(static_cast<AutocompleteMatchType::Type
>(t
));
392 return undemotable_types
;
395 bool OmniboxFieldTrial::ReorderForLegalDefaultMatch(
396 AutocompleteInput::PageClassification current_page_classification
) {
397 return OmniboxFieldTrial::GetValueForRuleInContext(
398 kReorderForLegalDefaultMatchRule
, current_page_classification
) !=
399 kReorderForLegalDefaultMatchRuleDisabled
;
402 void OmniboxFieldTrial::GetExperimentalHUPScoringParams(
403 HUPScoringParams
* scoring_params
) {
404 scoring_params
->experimental_scoring_enabled
= false;
406 VariationParams params
;
407 if (!chrome_variations::GetVariationParams(kBundledExperimentFieldTrialName
,
411 VariationParams::const_iterator it
= params
.find(kHUPNewScoringEnabledParam
);
412 if (it
!= params
.end()) {
414 if (base::StringToInt(it
->second
, &enabled
))
415 scoring_params
->experimental_scoring_enabled
= (enabled
!= 0);
418 InitializeScoreBuckets(params
, kHUPNewScoringTypedCountRelevanceCapParam
,
419 kHUPNewScoringTypedCountHalfLifeTimeParam
,
420 kHUPNewScoringTypedCountScoreBucketsParam
,
421 &scoring_params
->typed_count_buckets
);
422 InitializeScoreBuckets(params
, kHUPNewScoringVisitedCountRelevanceCapParam
,
423 kHUPNewScoringVisitedCountHalfLifeTimeParam
,
424 kHUPNewScoringVisitedCountScoreBucketsParam
,
425 &scoring_params
->visited_count_buckets
);
428 int OmniboxFieldTrial::HQPBookmarkValue() {
429 std::string bookmark_value_str
= chrome_variations::
430 GetVariationParamValue(kBundledExperimentFieldTrialName
,
431 kHQPBookmarkValueRule
);
432 if (bookmark_value_str
.empty())
434 // This is a best-effort conversion; we trust the hand-crafted parameters
435 // downloaded from the server to be perfect. There's no need for handle
438 base::StringToInt(bookmark_value_str
, &bookmark_value
);
439 return bookmark_value
;
442 bool OmniboxFieldTrial::HQPDiscountFrecencyWhenFewVisits() {
443 return chrome_variations::GetVariationParamValue(
444 kBundledExperimentFieldTrialName
,
445 kHQPDiscountFrecencyWhenFewVisitsRule
) == "true";
448 bool OmniboxFieldTrial::HQPAllowMatchInTLDValue() {
449 return chrome_variations::GetVariationParamValue(
450 kBundledExperimentFieldTrialName
,
451 kHQPAllowMatchInTLDRule
) == "true";
454 bool OmniboxFieldTrial::HQPAllowMatchInSchemeValue() {
455 return chrome_variations::GetVariationParamValue(
456 kBundledExperimentFieldTrialName
,
457 kHQPAllowMatchInSchemeRule
) == "true";
460 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName
[] =
461 "OmniboxBundledExperimentV1";
462 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule
[] =
463 "ShortcutsScoringMaxRelevance";
464 const char OmniboxFieldTrial::kSearchHistoryRule
[] = "SearchHistory";
465 const char OmniboxFieldTrial::kDemoteByTypeRule
[] = "DemoteByType";
466 const char OmniboxFieldTrial::kUndemotableTopTypeRule
[] = "UndemotableTopTypes";
467 const char OmniboxFieldTrial::kReorderForLegalDefaultMatchRule
[] =
468 "ReorderForLegalDefaultMatch";
469 const char OmniboxFieldTrial::kHQPBookmarkValueRule
[] =
471 const char OmniboxFieldTrial::kHQPDiscountFrecencyWhenFewVisitsRule
[] =
472 "HQPDiscountFrecencyWhenFewVisits";
473 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule
[] = "HQPAllowMatchInTLD";
474 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule
[] =
475 "HQPAllowMatchInScheme";
476 const char OmniboxFieldTrial::kZeroSuggestRule
[] = "ZeroSuggest";
477 const char OmniboxFieldTrial::kZeroSuggestVariantRule
[] = "ZeroSuggestVariant";
478 const char OmniboxFieldTrial::kReorderForLegalDefaultMatchRuleDisabled
[] =
479 "DontReorderForLegalDefaultMatch";
481 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam
[] =
482 "HUPExperimentalScoringEnabled";
483 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam
[] =
484 "TypedCountRelevanceCap";
485 const char OmniboxFieldTrial::kHUPNewScoringTypedCountHalfLifeTimeParam
[] =
486 "TypedCountHalfLifeTime";
487 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam
[] =
488 "TypedCountScoreBuckets";
489 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam
[] =
490 "VisitedCountRelevanceCap";
491 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountHalfLifeTimeParam
[] =
492 "VisitedCountHalfLifeTime";
493 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountScoreBucketsParam
[] =
494 "VisitedCountScoreBuckets";
496 // Background and implementation details:
498 // Each experiment group in any field trial can come with an optional set of
499 // parameters (key-value pairs). In the bundled omnibox experiment
500 // (kBundledExperimentFieldTrialName), each experiment group comes with a
501 // list of parameters in the form:
503 // <AutocompleteInput::PageClassification (as an int)>:
504 // <whether Instant Extended is enabled (as a 1 or 0)>
505 // (note that there are no linebreaks in keys; this format is for
506 // presentation only>
507 // value=<arbitrary string>
508 // Both the AutocompleteInput::PageClassification and the Instant Extended
509 // entries can be "*", which means this rule applies for all values of the
510 // matching portion of the context.
511 // One example parameter is
512 // key=SearchHistory:6:1
513 // value=PreventInlining
514 // This means in page classification context 6 (a search result page doing
515 // search term replacement) with Instant Extended enabled, the SearchHistory
516 // experiment should PreventInlining.
518 // When an exact match to the rule in the current context is missing, we
519 // give preference to a wildcard rule that matches the instant extended
520 // context over a wildcard rule that matches the page classification
521 // context. Hopefully, though, users will write their field trial configs
522 // so as not to rely on this fall back order.
524 // In short, this function tries to find the value associated with key
525 // |rule|:|page_classification|:|instant_extended|, failing that it looks up
526 // |rule|:*:|instant_extended|, failing that it looks up
527 // |rule|:|page_classification|:*, failing that it looks up |rule|:*:*,
528 // and failing that it returns the empty string.
529 std::string
OmniboxFieldTrial::GetValueForRuleInContext(
530 const std::string
& rule
,
531 AutocompleteInput::PageClassification page_classification
) {
532 VariationParams params
;
533 if (!chrome_variations::GetVariationParams(kBundledExperimentFieldTrialName
,
535 return std::string();
537 const std::string page_classification_str
=
538 base::IntToString(static_cast<int>(page_classification
));
539 const std::string instant_extended
=
540 chrome::IsInstantExtendedAPIEnabled() ? "1" : "0";
541 // Look up rule in this exact context.
542 VariationParams::const_iterator it
= params
.find(
543 rule
+ ":" + page_classification_str
+ ":" + instant_extended
);
544 if (it
!= params
.end())
546 // Fall back to the global page classification context.
547 it
= params
.find(rule
+ ":*:" + instant_extended
);
548 if (it
!= params
.end())
550 // Fall back to the global instant extended context.
551 it
= params
.find(rule
+ ":" + page_classification_str
+ ":*");
552 if (it
!= params
.end())
554 // Look up rule in the global context.
555 it
= params
.find(rule
+ ":*:*");
556 return (it
!= params
.end()) ? it
->second
: std::string();