#include "components/assist_ranker/predictor_config_definitions.h"
#include "base/metrics/field_trial_params.h"
#include "build/build_config.h"
#include "components/assist_ranker/base_predictor.h"
namespace assist_ranker {
#if BUILDFLAG(IS_ANDROID)
BASE_FEATURE(kContextualSearchRankerQuery,
"ContextualSearchRankerQuery",
base::FEATURE_DISABLED_BY_DEFAULT);
namespace {
const char kContextualSearchModelName[] = "contextual_search_model";
const char kContextualSearchLoggingName[] = "ContextualSearch";
const char kContextualSearchUmaPrefixName[] = "Search.ContextualSearch.Ranker";
const char kContextualSearchDefaultModelUrl[] =
"https://www.gstatic.com/chrome/intelligence/assist/ranker/models/"
"contextual_search/test_ranker_model_20171109_short_words_v2.pb.bin";
const base::FeatureParam<std::string>*
GetContextualSearchRankerUrlFeatureParam() {
static auto* kContextualSearchRankerUrl = new base::FeatureParam<std::string>(
&kContextualSearchRankerQuery, "contextual-search-ranker-model-url",
kContextualSearchDefaultModelUrl);
return kContextualSearchRankerUrl;
}
float GetContextualSearchRankerThresholdFeatureParam() {
static auto* kContextualSearchRankerThreshold =
new base::FeatureParam<double>(
&kContextualSearchRankerQuery,
"contextual-search-ranker-predict-threshold",
kNoPredictThresholdReplacement);
return static_cast<float>(kContextualSearchRankerThreshold->Get());
}
const base::flat_set<std::string>* GetContextualSearchFeatureAllowlist() {
static auto* kContextualSearchFeatureAllowlist =
new base::flat_set<std::string>();
return kContextualSearchFeatureAllowlist;
}
}
const PredictorConfig GetContextualSearchPredictorConfig() {
static auto kContextualSearchPredictorConfig = *(new PredictorConfig(
kContextualSearchModelName, kContextualSearchLoggingName,
kContextualSearchUmaPrefixName, LOG_UKM,
GetContextualSearchFeatureAllowlist(), &kContextualSearchRankerQuery,
GetContextualSearchRankerUrlFeatureParam(),
GetContextualSearchRankerThresholdFeatureParam()));
return kContextualSearchPredictorConfig;
}
#endif
}