Commit 673e5635 authored by tby's avatar tby Committed by Commit Bot

[Search ranking] Remove results_list_group_ranker_.

This removes the remaining references to the old 'cat' model, which we
are no longer using.

Bug: 1028447
Change-Id: I2d08e65e24fd979f485180338a03107902e57e76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2121597
Commit-Queue: Tony Yeoman <tby@chromium.org>
Reviewed-by: default avatarRachel Wong <wrong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753513}
parent 6fc0f206
...@@ -254,11 +254,6 @@ void SearchResultRanker::FetchRankings(const base::string16& query) { ...@@ -254,11 +254,6 @@ void SearchResultRanker::FetchRankings(const base::string16& query) {
zero_state_group_ranks_ = zero_state_group_ranker_->Rank(); zero_state_group_ranks_ = zero_state_group_ranker_->Rank();
} }
if (results_list_group_ranker_) {
group_ranks_.clear();
group_ranks_ = results_list_group_ranker_->Rank();
}
if (app_ranker_) { if (app_ranker_) {
// The Help app is being replaced with the Discover app, and we want to keep // The Help app is being replaced with the Discover app, and we want to keep
// ranking consistent by swapping the app IDs. The rename is a no-op if the // ranking consistent by swapping the app IDs. The rename is a no-op if the
...@@ -310,20 +305,6 @@ void SearchResultRanker::Rank(Mixer::SortedResults* results) { ...@@ -310,20 +305,6 @@ void SearchResultRanker::Rank(Mixer::SortedResults* results) {
if (last_query_.empty() && zero_state_group_ranker_) { if (last_query_.empty() && zero_state_group_ranker_) {
LogZeroStateResultScore(type, result.score); LogZeroStateResultScore(type, result.score);
ScoreZeroStateItem(&result, type, &zero_state_type_counts); ScoreZeroStateItem(&result, type, &zero_state_type_counts);
} else if (results_list_group_ranker_) {
const auto& rank_it =
group_ranks_.find(base::NumberToString(static_cast<int>(type)));
// The ranker only contains entries trained with types relating to files
// or the omnibox. This means scores for apps, app shortcuts, and answer
// cards will be unchanged.
if (rank_it != group_ranks_.end()) {
// Ranker scores are guaranteed to be in [0,1]. But, enforce that the
// result of tweaking does not put the score above 3.0, as that may
// interfere with apps or answer cards.
result.score = std::min(
result.score + rank_it->second * results_list_boost_coefficient_,
3.0);
}
} else if (!last_query_.empty() && } else if (!last_query_.empty() &&
use_aggregated_search_ranking_inference_) { use_aggregated_search_ranking_inference_) {
result.score = search_ranker_score_map[result.result->id()]; result.score = search_ranker_score_map[result.result->id()];
...@@ -408,21 +389,20 @@ void SearchResultRanker::Train(const AppLaunchData& app_launch_data) { ...@@ -408,21 +389,20 @@ void SearchResultRanker::Train(const AppLaunchData& app_launch_data) {
auto model = ModelForType(app_launch_data.ranking_item_type); auto model = ModelForType(app_launch_data.ranking_item_type);
if (model == Model::MIXED_TYPES) { if (model == Model::MIXED_TYPES) {
if (app_launch_data.query.empty() && zero_state_group_ranker_) { // We currently only have a mixed types model for zero-state, so stop if
// the launch has a query attached.
if (!app_launch_data.query.empty())
return;
LogZeroStateLaunchType(app_launch_data.ranking_item_type);
if (zero_state_group_ranker_) {
zero_state_group_ranker_->Record(base::NumberToString( zero_state_group_ranker_->Record(base::NumberToString(
static_cast<int>(app_launch_data.ranking_item_type))); static_cast<int>(app_launch_data.ranking_item_type)));
} else if (results_list_group_ranker_) {
results_list_group_ranker_->Record(base::NumberToString(
static_cast<int>(app_launch_data.ranking_item_type)));
} }
} else if (model == Model::APPS && app_ranker_) { } else if (model == Model::APPS && app_ranker_) {
app_ranker_->Record(NormalizeAppId(app_launch_data.id)); app_ranker_->Record(NormalizeAppId(app_launch_data.id));
} }
if (model == Model::MIXED_TYPES && app_launch_data.query.empty()) {
LogZeroStateLaunchType(app_launch_data.ranking_item_type);
}
LogChipUsageMetrics(app_launch_data); LogChipUsageMetrics(app_launch_data);
} }
......
...@@ -111,16 +111,6 @@ class SearchResultRanker : file_manager::file_tasks::FileTasksObserver { ...@@ -111,16 +111,6 @@ class SearchResultRanker : file_manager::file_tasks::FileTasksObserver {
// The query last provided to FetchRankings. // The query last provided to FetchRankings.
base::string16 last_query_; base::string16 last_query_;
// How much the scores produced by |results_list_group_ranker_| affect the
// final scores. Controlled by Finch.
float results_list_boost_coefficient_ = 0.0f;
// A model that ranks groups (eg. 'file' and 'omnibox'), which is used to
// tweak the results shown in the search results list only. This does not
// affect apps.
std::unique_ptr<RecurrenceRanker> results_list_group_ranker_;
std::map<std::string, float> group_ranks_;
// Ranks the kinds of results possible in the zero state results list. // Ranks the kinds of results possible in the zero state results list.
std::unique_ptr<RecurrenceRanker> zero_state_group_ranker_; std::unique_ptr<RecurrenceRanker> zero_state_group_ranker_;
std::map<std::string, float> zero_state_group_ranks_; std::map<std::string, float> zero_state_group_ranks_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment