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

Issue 10913262: Implement Bookmark Autocomplete Provider (Closed)

Created:
8 years, 3 months ago by mrossetti
Modified:
8 years, 2 months ago
CC:
chromium-reviews, MAD, James Su, jar (doing other things)
Visibility:
Public.

Description

Implement Bookmark Autocomplete Provider Introduce a new autocomplete provider that searches bookmarks by bookmark title. Note: The behavior of QueryNodeWord::HasMatchIn in query_parser.cc has been changed to return all match positions rather than just the first. Note: CoalesceMatchesFrom (in query_parser.cc) has been changed to replace the intersection of two match positions with the union of those two matches. Previously, it would behave differently based on ordering of the terms. BUG=13308, 154582, 155873 TEST=New unit tests added. Existing unit tests enhanced. pkasting: everything under autocomplete/. mpearson: scoring in bookmark_provider, also unit test. isherman: metrics (Done). sky: query_parser.h/.cc and bookmark_index.h/.cc. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=162807

Patch Set 1 #

Total comments: 39

Patch Set 2 : #

Patch Set 3 : #

Total comments: 16

Patch Set 4 : Address clint complaints. #

Total comments: 41

Patch Set 5 : #

Total comments: 27

Patch Set 6 : Now handles duplicate term matching. Comments, etc. #

Total comments: 33

Patch Set 7 : Fixed match position coalescing. #

Total comments: 12

Patch Set 8 : #

Patch Set 9 : Edited comments. #

Total comments: 10

Patch Set 10 : Final upload. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+755 lines, -20 lines) Patch
M chrome/browser/autocomplete/autocomplete_classifier.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_controller.cc View 1 2 3 4 4 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_match.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_match.cc View 1 2 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_provider.h View 1 2 3 4 5 4 chunks +15 lines, -10 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_provider.cc View 1 2 3 4 5 2 chunks +4 lines, -0 lines 0 comments Download
A chrome/browser/autocomplete/bookmark_provider.h View 1 2 3 4 5 6 7 8 9 1 chunk +72 lines, -0 lines 0 comments Download
A chrome/browser/autocomplete/bookmark_provider.cc View 1 2 3 4 5 6 7 8 9 1 chunk +272 lines, -0 lines 0 comments Download
A chrome/browser/autocomplete/bookmark_provider_unittest.cc View 1 2 3 4 5 6 7 1 chunk +341 lines, -0 lines 0 comments Download
M chrome/browser/autocomplete/history_provider.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/bookmarks/bookmark_index.h View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/bookmarks/bookmark_index.cc View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/bookmarks/bookmark_index_unittest.cc View 1 2 3 4 5 6 2 chunks +8 lines, -0 lines 0 comments Download
M chrome/browser/history/query_parser.h View 1 2 3 4 5 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/history/query_parser.cc View 1 2 3 4 5 6 7 3 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/history/query_parser_unittest.cc View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/metrics/metrics_log.cc View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_switches.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_switches.cc View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/common/metrics/proto/omnibox_event.proto View 1 2 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 31 (0 generated)
mrossetti
Mark, would you please take a look at the scoring of the bookmark result found ...
8 years, 3 months ago (2012-09-14 03:36:59 UTC) #1
Mark P
Some initial comments. I didn't get far into bookmark_provider.cc, but I did look through everything ...
8 years, 2 months ago (2012-09-28 00:55:13 UTC) #2
Mark P
Still haven't finished the rest of the .cc, but here are a few more comments, ...
8 years, 2 months ago (2012-09-28 23:10:22 UTC) #3
mrossetti
Thanks for the comments Mark. Issues addressed one way or the other. Please see my ...
8 years, 2 months ago (2012-10-02 00:44:15 UTC) #4
mrossetti
Mark, I've addressed the issues you mentioned. I need some guidance on the scoring, please.
8 years, 2 months ago (2012-10-03 02:15:15 UTC) #5
mrossetti
This is ready for general review: pkasting: all things autocomplete. mpearson: scoring approach in BookmarkProvider::TitleMatchToACMatch. ...
8 years, 2 months ago (2012-10-03 19:11:16 UTC) #6
Mark P
My remaining comments on everything (including scoring). I've looked at all the files except the ...
8 years, 2 months ago (2012-10-03 20:40:13 UTC) #7
Ilya Sherman
On 2012/10/03 19:11:16, mrossetti wrote: > sky: metrics/metrics_log.cc. Metrics changes LGTM. Please prefer people in ...
8 years, 2 months ago (2012-10-03 20:54:40 UTC) #8
sky
You want Ilya to review metrics, not me.
8 years, 2 months ago (2012-10-03 21:16:22 UTC) #9
mrossetti
Sorry about that. I scanned the OWNERS and saw 'sky' but it was a figment ...
8 years, 2 months ago (2012-10-03 21:26:51 UTC) #10
Peter Kasting
https://codereview.chromium.org/10913262/diff/29002/chrome/browser/autocomplete/autocomplete_classifier.cc File chrome/browser/autocomplete/autocomplete_classifier.cc (right): https://codereview.chromium.org/10913262/diff/29002/chrome/browser/autocomplete/autocomplete_classifier.cc#newcode28 chrome/browser/autocomplete/autocomplete_classifier.cc:28: const int AutocompleteClassifier::kInstantExtendedOmniboxProviders = Talk to dcblack about whether ...
8 years, 2 months ago (2012-10-04 20:40:30 UTC) #11
mrossetti
mpearson: I've completely reworked scoring (thank you for the advice). jar: please sign off on ...
8 years, 2 months ago (2012-10-05 22:10:04 UTC) #12
Peter Kasting
https://codereview.chromium.org/10913262/diff/29002/chrome/browser/autocomplete/autocomplete_match.h File chrome/browser/autocomplete/autocomplete_match.h (right): https://codereview.chromium.org/10913262/diff/29002/chrome/browser/autocomplete/autocomplete_match.h#newcode93 chrome/browser/autocomplete/autocomplete_match.h:93: BOOKMARK_TITLE, // A bookmark whose title contains the input. ...
8 years, 2 months ago (2012-10-05 22:14:28 UTC) #13
jar (doing other things)
I'm not a chrome/* owner, so I can't do much with a review of of ...
8 years, 2 months ago (2012-10-05 22:16:59 UTC) #14
sky
.gyp* LGTM
8 years, 2 months ago (2012-10-06 19:54:44 UTC) #15
Mark P
http://codereview.chromium.org/10913262/diff/29002/chrome/browser/autocomplete/autocomplete_classifier.cc File chrome/browser/autocomplete/autocomplete_classifier.cc (right): http://codereview.chromium.org/10913262/diff/29002/chrome/browser/autocomplete/autocomplete_classifier.cc#newcode28 chrome/browser/autocomplete/autocomplete_classifier.cc:28: const int AutocompleteClassifier::kInstantExtendedOmniboxProviders = On 2012/10/05 22:10:04, mrossetti wrote: ...
8 years, 2 months ago (2012-10-08 22:51:59 UTC) #16
Peter Kasting
http://codereview.chromium.org/10913262/diff/38001/chrome/browser/autocomplete/autocomplete_provider.h File chrome/browser/autocomplete/autocomplete_provider.h (right): http://codereview.chromium.org/10913262/diff/38001/chrome/browser/autocomplete/autocomplete_provider.h#newcode182 chrome/browser/autocomplete/autocomplete_provider.h:182: TYPE_BOOKMARK = 1 << 10, On 2012/10/08 22:51:59, Mark ...
8 years, 2 months ago (2012-10-09 18:30:41 UTC) #17
mrossetti
All issues addressed. Scott: Please note that I have made changes to bookmark_index.h/.cc and query_parser.h/.cc ...
8 years, 2 months ago (2012-10-10 02:26:42 UTC) #18
sky
LGTM
8 years, 2 months ago (2012-10-10 14:11:06 UTC) #19
Peter Kasting
https://codereview.chromium.org/10913262/diff/51001/chrome/browser/autocomplete/bookmark_provider.cc File chrome/browser/autocomplete/bookmark_provider.cc (right): https://codereview.chromium.org/10913262/diff/51001/chrome/browser/autocomplete/bookmark_provider.cc#newcode47 chrome/browser/autocomplete/bookmark_provider.cc:47: (input.matches_requested() == AutocompleteInput::BEST_MATCH && Nit: Be consistent about whether ...
8 years, 2 months ago (2012-10-10 18:29:06 UTC) #20
Mark P
I think we're almost there. :) --mark https://codereview.chromium.org/10913262/diff/51001/chrome/browser/autocomplete/bookmark_provider.cc File chrome/browser/autocomplete/bookmark_provider.cc (right): https://codereview.chromium.org/10913262/diff/51001/chrome/browser/autocomplete/bookmark_provider.cc#newcode86 chrome/browser/autocomplete/bookmark_provider.cc:86: // Note ...
8 years, 2 months ago (2012-10-10 22:28:57 UTC) #21
mrossetti
Issues hopefully addressed. sky@: I found another issue in the QueryParser so would appreciate your ...
8 years, 2 months ago (2012-10-15 19:22:45 UTC) #22
Peter Kasting
LGTM https://codereview.chromium.org/10913262/diff/65001/chrome/browser/autocomplete/bookmark_provider.cc File chrome/browser/autocomplete/bookmark_provider.cc (right): https://codereview.chromium.org/10913262/diff/65001/chrome/browser/autocomplete/bookmark_provider.cc#newcode44 chrome/browser/autocomplete/bookmark_provider.cc:44: // none of the BookmarkProvider's matches can score ...
8 years, 2 months ago (2012-10-15 22:17:21 UTC) #23
sky
https://codereview.chromium.org/10913262/diff/65001/chrome/browser/history/query_parser.cc File chrome/browser/history/query_parser.cc (right): https://codereview.chromium.org/10913262/diff/65001/chrome/browser/history/query_parser.cc#newcode39 chrome/browser/history/query_parser.cc:39: mp.first = std::min(mp.first, i->first); I get the need for ...
8 years, 2 months ago (2012-10-15 23:32:33 UTC) #24
mrossetti
Addressed all comments. mpearson, any last words? ;^) https://codereview.chromium.org/10913262/diff/65001/chrome/browser/autocomplete/bookmark_provider.cc File chrome/browser/autocomplete/bookmark_provider.cc (right): https://codereview.chromium.org/10913262/diff/65001/chrome/browser/autocomplete/bookmark_provider.cc#newcode44 chrome/browser/autocomplete/bookmark_provider.cc:44: // ...
8 years, 2 months ago (2012-10-16 16:38:05 UTC) #25
Mark P
lgtm Minor comments. --mark http://codereview.chromium.org/10913262/diff/51001/chrome/browser/autocomplete/bookmark_provider.cc File chrome/browser/autocomplete/bookmark_provider.cc (right): http://codereview.chromium.org/10913262/diff/51001/chrome/browser/autocomplete/bookmark_provider.cc#newcode212 chrome/browser/autocomplete/bookmark_provider.cc:212: title_match.match_positions.end(), ScoringFunctor(title.size())); On 2012/10/15 19:22:46, ...
8 years, 2 months ago (2012-10-18 18:37:54 UTC) #26
Mark P
I see you revised the code in response to most of my comments but forgot ...
8 years, 2 months ago (2012-10-19 17:11:17 UTC) #27
mrossetti
Final comments. Sorry for the delay. https://codereview.chromium.org/10913262/diff/78003/chrome/browser/autocomplete/bookmark_provider.cc File chrome/browser/autocomplete/bookmark_provider.cc (right): https://codereview.chromium.org/10913262/diff/78003/chrome/browser/autocomplete/bookmark_provider.cc#newcode157 chrome/browser/autocomplete/bookmark_provider.cc:157: AutocompleteMatch BookmarkProvider::TitleMatchToACMatch( On ...
8 years, 2 months ago (2012-10-19 17:33:06 UTC) #28
Mark P
https://codereview.chromium.org/10913262/diff/78003/chrome/browser/autocomplete/bookmark_provider.cc File chrome/browser/autocomplete/bookmark_provider.cc (right): https://codereview.chromium.org/10913262/diff/78003/chrome/browser/autocomplete/bookmark_provider.cc#newcode208 chrome/browser/autocomplete/bookmark_provider.cc:208: // Once all term factors have been calculated they ...
8 years, 2 months ago (2012-10-19 17:50:43 UTC) #29
mrossetti
On 2012/10/19 17:50:43, Mark P wrote: > Ah, I see why I thought your comment ...
8 years, 2 months ago (2012-10-19 18:34:38 UTC) #30
Mark P
8 years, 2 months ago (2012-10-19 22:35:44 UTC) #31
>
>
>
> https://codereview.chromium.**org/10913262/diff/78003/**
>
chrome/browser/autocomplete/**bookmark_provider.cc#**newcode209<https://codereview.chromium.org/10913262/diff/78003/chrome/browser/autocomplete/bookmark_provider.cc#newcode209>
>
>> chrome/browser/autocomplete/**bookmark_provider.cc:209: // sum will
>> never be
>> greater than 1.0. This sum is then multiplied against
>> On 2012/10/19 17:33:07, mrossetti wrote:
>> > On 2012/10/18 18:37:54, Mark P wrote:
>> > > Why will it never be greater than 1.0?
>> > >
>> > > I think it has to do with how duplicates/overlaps are eliminated in
>> > > GetBookmarksWithTitlesMatching**(), but it would help to claim that
>> directly
>> if
>> > > that's what you're relying in.
>> > >
>> > > And if indeed it's true, please DCHECK it.
>> >
>> > The math is pure. It can never be greater than 1.0 other than the
>> potential
>> for
>> > a very minor fractional rounding error that might make it 1.0+epsilon.
>> Even
>> with
>> > that very slight difference the resulting partial score will always be
>>
> clamped
>
>> > to the maximum possible of 299.
>>
>
>  Consider the title "food" and omnibox input "foo ood".  If term matches
>> ends
>>
> up
>
>> with a three character match foo and a three character match ood, then
>> your
>> factors will be
>> 3/4 * 1
>> 3/4 * 3/4
>> The sum of these is 1.3125 > 1.0.
>>
>
> I fear I'm being pedantic, but this particular combination will not occur.
> Given
> omnibox input of "foo ood" and a bookmark title of "food" the match will
> fail
> because only prefix matches are valid with the BookmarkIndex; the "ood"
> will not
> match anything since it's not a prefix. This is tested in the
> BookmarkProviderTest.Positions unit test (see "foo bar" and "a d"). I will
> point
> out, however, that the QueryParser coalescing code will properly handle
> this
> case should we ever decide to allow non-prefix matches against bookmark
> titles.
>
> Nevertheless, there _are_ title/query combinations that _will_ demonstrate
> your
> point. This case is also tested in the unit tests. Two queries of
> particular
> interest are "foobar foo" and "foo foobar", both of which have overlapping
> matches against the title "foobar foobar". In the case of query "foo
> foobar" the
> initial match positions set will be {{0,3}, {7,10}, {0,6}, {7,13}}. These
> are
> coalesced into the match positions set {{0,6}, {7,13}}.


Okay.

Next time you're in the code, I'd love if you can something after the
sentence "the resulting sum will never be greater than 1."  Perhaps
something like:
... because of the way the bookmark model matches and removes overlaps.
 (In particular, the bookmarks models only matches terms to the beginning
of words and it removes all overlapping matches, keeping only the longest.
 Together these mean that each character is included in at most one match.
 This property ensures the sum of factors is at most 1.)

--mark


>
>
>  The only way the match works out ("is pure") is the bookmarks search never
>> reports overlapping matching.  If this is true, you should assert it in
>>
> comments
>
>> and claim that the math works out precisely for this reason.
>>
>
>  Regardless, I think a DCHECK is appropriate. (Even if it's true, the
>> DCHECK
>>
> may
>
>> help prevent regressions in how the bookmark search works.)
>>
>
> I believe that a DCHECK should usually be reserved for potentially
> catastrophic
> error conditions and where unit tests cannot normally be counted on to
> catch a
> change in environment. In this case, should the BookmarkIndex search or
> QueryParser coalescing be changed such that the match position coalescing
> no
> longer works as this scoring algorithm expects, the BookmarkProvider unit
> tests
> will fail, quickly pointing out a problem.
>
>
https://codereview.chromium.**org/10913262/<https://codereview.chromium.org/1...
>

Powered by Google App Engine
This is Rietveld 408576698