Commit a306ca37 authored by Ce Chen's avatar Ce Chen Committed by Commit Bot

[omnibox] on device suggestions demotion should happen before dedup.

The reason why we should apply demotion before dedup, is dedup will
prefer suggestions with higher relevance (which might be on device,
and remove its dup with lower relevance, which might be server side).

Imagine this example:
we have on device suggestions (and its relevance):
sugg1(1100), sugg2(1099), sugg3(1098) and server suggestions
sugg2(600), sugg4(599). Now the dedup will prefer sugg2(1099) and
remove server side sugg2(600).
Then after demotion, the final result list will be sugg4(599),
sugg1(598), sugg2(597, which is from on device), sugg3(596),
where the correct list should be sugg2(600, from server side),
sugg4(599), sugg1(598), sugg3(597).

Applying demotion first will ensure no on device suggestion has a
higher relevance such that the example above will never happen.

Bug: 925072
Change-Id: Ic1b8a2de1e602802b59d93e1971387f0ae7e67ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1760685Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Ce Chen <cch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688377}
parent 18c9f338
......@@ -176,10 +176,10 @@ void AutocompleteResult::SortAndCull(
MaybeCullTailSuggestions(&matches_);
}
#endif
DeduplicateMatches(input.current_page_classification(), &matches_);
DemoteOnDeviceSearchSuggestions();
DeduplicateMatches(input.current_page_classification(), &matches_);
// Sort and trim to the most relevant GetMaxMatches() matches.
CompareWithDemoteByType<AutocompleteMatch> comparing_object(
input.current_page_classification());
......
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