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_; |