diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-05 17:04:56 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-05 17:04:56 +0000 |
commit | acf434c6f5373fe5b6b13c43414b781e953bb607 (patch) | |
tree | f5024a575eb4d5f9af4eda59f53c312f6ff099bf /chrome/browser/bookmarks | |
parent | 54a81defc8e4844c21d279775f9dc9af7045799d (diff) | |
download | chromium_src-acf434c6f5373fe5b6b13c43414b781e953bb607.zip chromium_src-acf434c6f5373fe5b6b13c43414b781e953bb607.tar.gz chromium_src-acf434c6f5373fe5b6b13c43414b781e953bb607.tar.bz2 |
Fix a DCHECK hit inside the bookmark matching code.
We do bookmark matching in two passes: first, a quick search for all
the words, then a second filtering pass that obeys query syntax.
We were hitting a DCHECK when the second pass would filter any matches
out. For example, the query ["thi"] matches a bookmark [think], but
it shouldn't match because quotes mean literal match.
BUG=15786
Review URL: http://codereview.chromium.org/159905
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22485 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_index.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/chrome/browser/bookmarks/bookmark_index.cc b/chrome/browser/bookmarks/bookmark_index.cc index 0bdc87f..fa512c2 100644 --- a/chrome/browser/bookmarks/bookmark_index.cc +++ b/chrome/browser/bookmarks/bookmark_index.cc @@ -72,15 +72,16 @@ void BookmarkIndex::AddMatchToResults( std::vector<bookmark_utils::TitleMatch>* results) { for (NodeSet::const_iterator i = match.nodes_begin(); i != match.nodes_end() && results->size() < max_count; ++i) { - results->push_back(bookmark_utils::TitleMatch()); - bookmark_utils::TitleMatch& title_match = results->back(); - title_match.node = *i; - if (!parser->DoesQueryMatch((*i)->GetTitle(), query_nodes, - &(title_match.match_positions))) { - // If we get here it implies the QueryParser didn't match something we - // thought should match. We should always match the same thing as the - // query parser. - NOTREACHED(); + bookmark_utils::TitleMatch title_match; + // Check that the result matches the query. The previous search + // was a simple per-word search, while the more complex matching + // of QueryParser may filter it out. For example, the query + // ["thi"] will match the bookmark titled [Thinking], but since + // ["thi"] is quoted we don't want to do a prefix match. + if (parser->DoesQueryMatch((*i)->GetTitle(), query_nodes, + &(title_match.match_positions))) { + title_match.node = *i; + results->push_back(title_match); } } } |