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

Unified Diff: components/omnibox/browser/url_index_private_data.h

Issue 2187343002: Generating autocomplete results with and without word breaks in the Omnibox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added the fungoodtimes twitter URL to the end of the list. Placed ExtractIndividualWordVector, Get… Created 4 years, 4 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: components/omnibox/browser/url_index_private_data.h
diff --git a/components/omnibox/browser/url_index_private_data.h b/components/omnibox/browser/url_index_private_data.h
index 100692cd7b44e63de9bfbc2b01c3501a6e2bbd95..bfbfb573681e58087c0163fda5749bd6443de4db 100644
--- a/components/omnibox/browser/url_index_private_data.h
+++ b/components/omnibox/browser/url_index_private_data.h
@@ -50,19 +50,18 @@ class URLIndexPrivateData
public:
URLIndexPrivateData();
- // Given a base::string16 in |term_string|, scans the history index and
- // returns a vector with all scored, matching history items. The
- // |term_string| is broken down into individual terms (words), each of which
- // must occur in the candidate history item's URL or page title for the item
- // to qualify; however, the terms do not necessarily have to be adjacent. We
- // also allow breaking |term_string| at |cursor_position| (if
- // set). Once we have a set of candidates, they are filtered to ensure
- // that all |term_string| terms, as separated by whitespace and the
- // cursor (if set), occur within the candidate's URL or page title.
- // Scores are then calculated on no more than |kItemsToScoreLimit|
- // candidates, as the scoring of such a large number of candidates may
- // cause perceptible typing response delays in the omnibox. This is
- // likely to occur for short omnibox terms such as 'h' and 'w' which
+ // Given |term_string|, scans the history index and returns a vector with
Mark P 2016/08/24 20:15:03 nit: the "a" here that was before "|term_string|"
Lavar Askew 2016/08/24 20:23:50 Done.
+ // all scored, matching history items. The |term_string| is broken down into
+ // individual terms (words), each of which must occur in the candidate
+ // history item's URL or page title for the item to qualify; however, the
+ // terms do not necessarily have to be adjacent. We also allow breaking
+ // |term_string| at |cursor_position| (if set). Once we have a set of
+ // candidates, they are filtered to ensure that all |term_string| terms, as
+ // separated by whitespace and the cursor (if set), occur within the
+ // candidate's URL or page title. Scores are then calculated on no more than
+ // |kItemsToScoreLimit| candidates, as the scoring of such a large number of
+ // candidates may cause perceptible typing response delays in the omnibox.
+ // This is likely to occur for short omnibox terms such as 'h' and 'w' which
// will be found in nearly all history candidates. Results are sorted by
// descending score. The full results set (i.e. beyond the
// |kItemsToScoreLimit| limit) will be retained and used for subsequent calls
@@ -326,6 +325,31 @@ class URLIndexPrivateData
static bool URLSchemeIsWhitelisted(const GURL& gurl,
const std::set<std::string>& whitelist);
+ // Support functions for HistoryItemsForTerms
+
+ // Returns a vector of individual words from |search_string|, in order of
+ // appearance, duplicates allowed.
+ String16Vector ExtractIndividualWordVector(
+ const base::string16& search_string);
+
+ // Given |lower_words|, scans the history index and returns the set of
+ // matching history item IDs. Will return an empty HistoryIDSet if
+ // |lower_words| is empty.
+ HistoryIDSet GetHistoryIDSet(const String16Vector& lower_words);
+
+ // This function is responsible for splitting |search_string| into a vector
+ // of terms based on 'true' whitespace as opposed to escaped whitespace,
+ // e.g., When the user types "colspec=ID%20Mstone Release" we get two
+ //'terms': "colspec=id%20mstone" and "release". Each URL in the user's
+ // history is scored against the vector of terms. The matches are returned
+ // sorted based on highest score.
+ ScoredHistoryMatches GetScoredItemsForSearchString(
+ const base::string16& search_string,
+ const HistoryIDSet& history_id_set,
+ const size_t max_matches,
+ bookmarks::BookmarkModel* bookmark_model,
+ TemplateURLService* template_url_service);
+
// Cache of search terms.
SearchTermCacheMap search_term_cache_;

Powered by Google App Engine
This is Rietveld 408576698