Index: chrome/browser/autocomplete/history_contents_provider.cc |
diff --git a/chrome/browser/autocomplete/history_contents_provider.cc b/chrome/browser/autocomplete/history_contents_provider.cc |
index 190d0a3afc85bbd3186f5ca0caeda03bd8bdfa81..d6219523e9f3e62cec56c1ec010612832fdb7e95 100644 |
--- a/chrome/browser/autocomplete/history_contents_provider.cc |
+++ b/chrome/browser/autocomplete/history_contents_provider.cc |
@@ -31,6 +31,15 @@ namespace { |
// time it will take. |
const int kDaysToSearch = 30; |
+// The maximum number of characters used in a search for full text results. |
+// This was chosen arbitrarily because omnibox results that come back too |
+// late (after tens of seconds) aren't useful to the user so it's not |
+// worth spending CPU time on them. Furthermore, if a URL matches the |
+// first 2k of characters the user typed (more likely pasted) into the |
+// omnibox, it's likely it matches the rest; there's strongly diminished |
+// returns for the ability to add additional search terms. |
+const size_t kMaxCharactersToConsider = 2000u; |
Peter Kasting
2013/04/17 22:59:45
Nit: Since this is only used in one function I sug
Mark P
2013/04/17 23:06:48
I kind of like having parameters called out somewh
Peter Kasting
2013/04/17 23:09:01
I don't care strongly. I always read the style gu
Mark P
2013/04/17 23:13:28
Okay, done.
|
+ |
} // namespace |
HistoryContentsProvider::MatchReference::MatchReference( |
@@ -139,7 +148,9 @@ void HistoryContentsProvider::Start(const AutocompleteInput& input, |
options.body_only = body_only_; |
options.SetRecentDayRange(kDaysToSearch); |
options.max_count = kMaxMatches; |
- history->QueryHistory(input.text(), options, |
+ history->QueryHistory( |
+ input.text().substr(0, kMaxCharactersToConsider), |
+ options, |
&request_consumer_, |
base::Bind(&HistoryContentsProvider::QueryComplete, |
base::Unretained(this))); |