Skip to content

Commit

Permalink
[Omnibox][ML] Implement url scoring signals annotator.
Browse files Browse the repository at this point in the history
- Annotates URL suggestions with query-url matching signals.

Bug: b/262622636
Change-Id: Iae5b84d09017bd51dd3831b3f1079452e4960083
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4141938
Reviewed-by: manuk hovanesian <manukh@chromium.org>
Commit-Queue: Jun Zou <junzou@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1101234}
  • Loading branch information
Jun Zou authored and Chromium LUCI CQ committed Feb 3, 2023
1 parent e152def commit 26ebc95
Show file tree
Hide file tree
Showing 9 changed files with 678 additions and 100 deletions.
3 changes: 3 additions & 0 deletions components/omnibox/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ static_library("browser") {
"url_index_private_data.h",
"url_prefix.cc",
"url_prefix.h",
"url_scoring_signals_annotator.cc",
"url_scoring_signals_annotator.h",
"verbatim_match.cc",
"verbatim_match.h",
"voice_suggest_provider.cc",
Expand Down Expand Up @@ -694,6 +696,7 @@ source_set("unit_tests") {
"tailored_word_break_iterator_unittest.cc",
"titled_url_match_utils_unittest.cc",
"url_prefix_unittest.cc",
"url_scoring_signals_annotator_unittest.cc",
"voice_suggest_provider_unittest.cc",
"zero_suggest_cache_service_unittest.cc",
"zero_suggest_provider_unittest.cc",
Expand Down
3 changes: 3 additions & 0 deletions components/omnibox/browser/autocomplete_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "components/omnibox/browser/query_tile_provider.h"
#include "components/omnibox/browser/search_provider.h"
#include "components/omnibox/browser/shortcuts_provider.h"
#include "components/omnibox/browser/url_scoring_signals_annotator.h"
#include "components/omnibox/browser/voice_suggest_provider.h"
#include "components/omnibox/browser/zero_suggest_provider.h"
#include "components/omnibox/browser/zero_suggest_verbatim_match_provider.h"
Expand Down Expand Up @@ -520,6 +521,8 @@ AutocompleteController::AutocompleteController(
url_scoring_signals_annotators_.push_back(
std::make_unique<BookmarkScoringSignalsAnnotator>(
provider_client_.get()));
url_scoring_signals_annotators_.push_back(
std::make_unique<UrlScoringSignalsAnnotator>());
}

base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
Expand Down
9 changes: 7 additions & 2 deletions components/omnibox/browser/history_match.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ bool HistoryMatch::EqualsGURL(const HistoryMatch& h, const GURL& url) {
return h.url_info.url() == url;
}

// static
bool HistoryMatch::IsHostOnly(const GURL& gurl) {
return (!gurl.has_path() || (gurl.path_piece() == "/")) &&
!gurl.has_query() && !gurl.has_ref();
}

size_t HistoryMatch::EstimateMemoryUsage() const {
return base::trace_event::EstimateMemoryUsage(url_info);
}

bool HistoryMatch::IsHostOnly() const {
const GURL& gurl = url_info.url();
DCHECK(gurl.is_valid());
return (!gurl.has_path() || (gurl.path_piece() == "/")) &&
!gurl.has_query() && !gurl.has_ref();
return IsHostOnly(gurl);
}

} // namespace history
3 changes: 3 additions & 0 deletions components/omnibox/browser/history_match.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ struct HistoryMatch {

static bool EqualsGURL(const HistoryMatch& h, const GURL& url);

// True if the url contains only a host, e.g. "http://www.google.com/".
static bool IsHostOnly(const GURL& gurl);

// Returns true if url in this HistoryMatch is just a host
// (e.g. "http://www.google.com/") and not some other subpage
// (e.g. "http://www.google.com/foo.html").
Expand Down

0 comments on commit 26ebc95

Please sign in to comment.