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

Unified Diff: chrome/browser/history/url_index_private_data.cc

Issue 9289034: Fix keyword recognition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Now handles multiple occurrences of search term in URL. Added test. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/url_index_private_data.cc
===================================================================
--- chrome/browser/history/url_index_private_data.cc (revision 119252)
+++ chrome/browser/history/url_index_private_data.cc (working copy)
@@ -530,12 +530,19 @@
match.title_matches = SortAndDeoverlapMatches(match.title_matches);
// We can inline autocomplete a result if:
- // 1) the search term starts at the beginning of the candidate URL, OR
- // 2) the candidate URL has one of the standard 'ftp' or 'http[s]'
- // prefixes.
- match.can_inline = match.url_matches.size() &&
+ // 1) there is only one search term
+ // 2) AND EITHER:
+ // 2a) the first match starts at the beginning of the candidate URL, OR
+ // 2b) the candidate URL starts with one of the standard URL prefixes with
+ // the URL match immediately following that prefix.
+ // 4) AND the search string does not end in whitespace (making it look to
Peter Kasting 2012/01/26 23:04:30 Nit: 4 -> 3
mrossetti 2012/01/26 23:09:37 Done.
+ // the IMUI as though there is a single search term when actually there
+ // is a second, empty term).
+ match.can_inline = match.url_matches.size() > 0 &&
Peter Kasting 2012/01/26 23:04:30 Nit: !empty()
mrossetti 2012/01/26 23:09:37 Done.
+ terms.size() == 1 &&
(match.url_matches[0].offset == 0 ||
- IsInlineablePrefix(url.substr(0, match.url_matches[0].offset)));
+ IsInlineablePrefix(url.substr(0, match.url_matches[0].offset))) &&
+ !IsWhitespace(*(lower_string.rbegin()));
// Get partial scores based on term matching. Note that the score for
// each of the URL and title are adjusted by the fraction of the
« no previous file with comments | « chrome/browser/history/in_memory_url_index_unittest.cc ('k') | chrome/test/data/History/url_history_provider_test.db.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698