Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Issue 69703002: Modified GetMatchToPrefetch() to return a valid match for prefetching even when hide_verbatim flag i (Closed)

Created:
7 years, 1 month ago by kmadhusu
Modified:
7 years ago
CC:
chromium-reviews
Visibility:
Public.

Description

Modified GetMatchToPrefetch() to return a valid match for prefetching even when hide_verbatim flag is turned off. Details (repeating our email conversation) : This change is for re-implementation of Chrome Instant (Design doc: https://goto.google.com/fdgbe), in which the Suggest server tells Chrome which search suggestion to prefetch and then Chrome uses the hint details to prefetch the query results. We only prerender the top match marked for prefetching. But this doesn't work because of how Chrome deals with verbatim matches. So, we initially proposed that we require the search to be the top match, except for the cases where hide verbatim applied and the verbatim match is hidden. This works well but unfortunately, it seems like hide verbatim won't work without further UI changes in the omnibox. Until we figure out a way to hide the top verbatim match, we want to continue doing the same even with the hide verbatim turned off. In this CL, I made changes to obey the prefetch hint if the search is the top match, unless it is only being outranked by a verbatim suggestion match. BUG=269186 TEST=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=240747

Patch Set 1 #

Total comments: 2

Patch Set 2 : Addressed comment #

Total comments: 18

Patch Set 3 : Rebase #

Patch Set 4 : Addressed comments #

Total comments: 15

Patch Set 5 : Rebase #

Patch Set 6 : Addressed comments #

Total comments: 16
Unified diffs Side-by-side diffs Delta from patch set Stats (+181 lines, -51 lines) Patch
M chrome/browser/autocomplete/autocomplete_result.h View 1 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_result.cc View 1 2 3 1 chunk +6 lines, -11 lines 6 comments Download
M chrome/browser/autocomplete/autocomplete_result_unittest.cc View 1 2 3 4 5 3 chunks +157 lines, -32 lines 8 comments Download
M chrome/browser/ui/omnibox/omnibox_controller.cc View 1 2 2 chunks +13 lines, -8 lines 2 comments Download

Messages

Total messages: 17 (0 generated)
kmadhusu
Please review. Thanks.
7 years, 1 month ago (2013-11-12 00:14:53 UTC) #1
samarth
https://codereview.chromium.org/69703002/diff/1/chrome/browser/ui/omnibox/omnibox_controller.cc File chrome/browser/ui/omnibox/omnibox_controller.cc (right): https://codereview.chromium.org/69703002/diff/1/chrome/browser/ui/omnibox/omnibox_controller.cc#newcode40 chrome/browser/ui/omnibox/omnibox_controller.cc:40: return ((default_match != result.end()) && This isn't quite right. ...
7 years, 1 month ago (2013-11-14 16:17:45 UTC) #2
Peter Kasting
On 2013/11/14 16:17:45, samarth wrote: > https://codereview.chromium.org/69703002/diff/1/chrome/browser/ui/omnibox/omnibox_controller.cc > File chrome/browser/ui/omnibox/omnibox_controller.cc (right): > > https://codereview.chromium.org/69703002/diff/1/chrome/browser/ui/omnibox/omnibox_controller.cc#newcode40 > ...
7 years, 1 month ago (2013-11-15 01:23:42 UTC) #3
kmadhusu
On 2013/11/15 01:23:42, Peter Kasting wrote: > On 2013/11/14 16:17:45, samarth wrote: > > > ...
7 years, 1 month ago (2013-11-15 03:23:25 UTC) #4
kmadhusu
Updated CL description. Addressed review comment. Adding mpearson@ to review autocomplete/* changes since pkasting@ is ...
7 years ago (2013-12-12 01:04:01 UTC) #5
Mark P
This is consistent with what I understand the agreement between you and pkasting@ is. I'll ...
7 years ago (2013-12-12 23:13:06 UTC) #6
kmadhusu
mpearson@: Addressed review comments. PTAL. Thanks. https://codereview.chromium.org/69703002/diff/120001/chrome/browser/autocomplete/autocomplete_result.cc File chrome/browser/autocomplete/autocomplete_result.cc (right): https://codereview.chromium.org/69703002/diff/120001/chrome/browser/autocomplete/autocomplete_result.cc#newcode272 chrome/browser/autocomplete/autocomplete_result.cc:272: // false to ...
7 years ago (2013-12-13 01:00:29 UTC) #7
Mark P
lgtm, feel free to submit after you resolve these latest comments https://codereview.chromium.org/69703002/diff/180001/chrome/browser/autocomplete/autocomplete_result_unittest.cc File chrome/browser/autocomplete/autocomplete_result_unittest.cc (right): ...
7 years ago (2013-12-13 01:10:55 UTC) #8
kmadhusu
mpearson@: Addressed comments. Thanks. https://codereview.chromium.org/69703002/diff/180001/chrome/browser/autocomplete/autocomplete_result_unittest.cc File chrome/browser/autocomplete/autocomplete_result_unittest.cc (right): https://codereview.chromium.org/69703002/diff/180001/chrome/browser/autocomplete/autocomplete_result_unittest.cc#newcode81 chrome/browser/autocomplete/autocomplete_result_unittest.cc:81: // Creates an AutocompleteMatch using ...
7 years ago (2013-12-13 17:59:17 UTC) #9
samarth
lgtm looks great!
7 years ago (2013-12-13 18:11:35 UTC) #10
kmadhusu
sky@: Please do the OWNER's check for omnibox_controller.cc changes. Thanks.
7 years ago (2013-12-13 18:22:17 UTC) #11
sky
LGTM
7 years ago (2013-12-13 18:31:18 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kmadhusu@chromium.org/69703002/240001
7 years ago (2013-12-13 18:33:29 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kmadhusu@chromium.org/69703002/240001
7 years ago (2013-12-13 19:19:44 UTC) #14
commit-bot: I haz the power
Change committed as 240747
7 years ago (2013-12-13 21:09:42 UTC) #15
Peter Kasting
Maybe address these in a followup CL? https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocomplete/autocomplete_result.cc File chrome/browser/autocomplete/autocomplete_result.cc (right): https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocomplete/autocomplete_result.cc#newcode261 chrome/browser/autocomplete/autocomplete_result.cc:261: // Gate ...
7 years ago (2013-12-17 23:47:34 UTC) #16
kmadhusu
7 years ago (2013-12-18 23:26:08 UTC) #17
Message was sent while issue was closed.
pkasting@: Addressed review comments. Uploaded the follow up changes in
crrev.com/101043011. PTAL.

Thanks.

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocompl...
File chrome/browser/autocomplete/autocomplete_result.cc (right):

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocompl...
chrome/browser/autocomplete/autocomplete_result.cc:261: // Gate on our field
trial flag.
On 2013/12/17 23:47:34, Peter Kasting wrote:
> Nit: Remove this comment.

Done.

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocompl...
chrome/browser/autocomplete/autocomplete_result.cc:266: bool
AutocompleteResult::TopMatchIsVerbatimAndHasNoConsecutiveVerbatimMatches()
On 2013/12/17 23:47:34, Peter Kasting wrote:
> Nit: Name this TopMatchIsStandaloneVerbatimMatch() to shorten the name enough
to
> not have to wrap "const" to the next line.

Done.

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocompl...
chrome/browser/autocomplete/autocomplete_result.cc:270: return !(size() > 1) ||
!match_at(1).IsVerbatimType();
On 2013/12/17 23:47:34, Peter Kasting wrote:
> Nit: Simpler:
> 
>   return !empty() && match_at(0).IsVerbatimType() &&
>       ((size() == 1) || !match_at(1).IsVerbatimType());

Done.

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocompl...
File chrome/browser/autocomplete/autocomplete_result_unittest.cc (right):

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocompl...
chrome/browser/autocomplete/autocomplete_result_unittest.cc:30: ACMatches*
matches) {
On 2013/12/17 23:47:34, Peter Kasting wrote:
> Nit: One arg per line

Done.

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocompl...
chrome/browser/autocomplete/autocomplete_result_unittest.cc:33:
!matches->empty() ? &((*matches)[matches->size() - 1]) : NULL;
On 2013/12/17 23:47:34, Peter Kasting wrote:
> Nit: Needlessly verbose.  ELiminate this line and do the following below:
> 
>   match.relevance = matches->empty() ? 1300 : (matches->back().relevance -
100);

Done.

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocompl...
chrome/browser/autocomplete/autocomplete_result_unittest.cc:349:
matches[matches.size() - 1].relevance = 500;
On 2013/12/17 23:47:34, Peter Kasting wrote:
> Nit: Use matches.back()

Done.

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/autocompl...
chrome/browser/autocomplete/autocomplete_result_unittest.cc:487:
TEST_F(AutocompleteResultTest, ShouldHideTopMatch) {
On 2013/12/17 23:47:34, Peter Kasting wrote:
> There are a ton of tests here, most of which start with very similar
AddMatch()
> calls.  Can we collapse most of these into one or two tests, which have an
array
> of details used to construct matches, use a for() loop to add them as
necessary,
> check the relevant function return values, then clear state and start over?

Done.

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/ui/omnibo...
File chrome/browser/ui/omnibox/omnibox_controller.cc (right):

https://codereview.chromium.org/69703002/diff/240001/chrome/browser/ui/omnibo...
chrome/browser/ui/omnibox/omnibox_controller.cc:55: &result.match_at(1) : NULL;
On 2013/12/17 23:47:34, Peter Kasting wrote:
> Nit: Indenting here is inconsistent; sometimes you're indenting even with the
> inside of the parens, other times 4.  Do this:
> 
> {
>   // If the default match should be prefetched, do that.
>   if ((result.default_match() != result.end()) &&
>       SearchProvider::ShouldPrefetch(*result.default_match()))
>     return &(*default_match);
> 
>   // Otherwise, if the top match is a verbatim match and the very next match
is
>   // prefetchable, fetch that.
>   if ((result.ShouldHideTopMatch() || TopMatchIsStandaloneVerbatimMatch()) &&
>       (result.size() > 1) &&
SearchProvider::ShouldPrefetch(result.match_at(1)))
>     return &result.match_at(1);
> 
>   return NULL;
> }
> 
> Note that this allows the second conditional to run when there is no default
> match; this seems theoretically more like what you actually want, even though
it
> will have no practical effect.
> 

Fixed indentation. 

> This also adds some comments.  Writing them made me question whether we really
> want to call TopMatchIsStandaloneVerbatimMatch() here.  Are you sure we don't
> just want to always prefetch any match in position 1 or 2?

Lets start with the conservative approach and expand later if  things work well.

Powered by Google App Engine
This is Rietveld 408576698