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

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

Issue 16776004: Replace FTS in the history_service with a brute force text search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix kSafeRegexWordBoundary for Korean. Created 7 years, 6 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
« no previous file with comments | « chrome/browser/history/url_database.h ('k') | chrome/browser/history/visit_database.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/url_database.cc
diff --git a/chrome/browser/history/url_database.cc b/chrome/browser/history/url_database.cc
index 0856d25ef4f7a508a0af2939879ed4a9f810bc85..395c367161b0f3860f430f9adbf9e887b9a1ebe5 100644
--- a/chrome/browser/history/url_database.cc
+++ b/chrome/browser/history/url_database.cc
@@ -358,6 +358,32 @@ bool URLDatabase::FindShortestURLFromBase(const std::string& base,
return true;
}
+bool URLDatabase::GetTextMatches(const string16& query, URLRows* results) {
+ std::vector<string16> regexp_queries;
+ query_parser_.ParseQueryAsRegexps(query, &regexp_queries);
+
+ std::string sql("SELECT ");
+ sql.append(kURLRowFields);
+ sql.append(" FROM urls WHERE ");
+ for (size_t i = 0; i < regexp_queries.size(); ++i) {
+ sql.append(" (url REGEXP ? OR title REGEXP ?) AND ");
+ }
+ sql.append(" hidden = 0");
+ sql::Statement statement(GetDB().GetUniqueStatement(sql.c_str()));
Scott Hess - ex-Googler 2013/06/12 17:38:34 You may want to reference http://crbug.com/248608
rmcilroy 2013/06/13 15:32:05 Ack (no longer required).
+ for (size_t i = 0; i < regexp_queries.size(); ++i) {
+ statement.BindString16(2 * i, regexp_queries[i]);
+ statement.BindString16((2 * i) + 1, regexp_queries[i]);
+ }
+
+ while (statement.Step()) {
+ history::URLRow info;
+ FillURLRow(statement, &info);
+ if (info.url().is_valid())
+ results->push_back(info);
+ }
+ return !results->empty();
+}
+
bool URLDatabase::InitKeywordSearchTermsTable() {
has_keyword_search_terms_ = true;
if (!GetDB().DoesTableExist("keyword_search_terms")) {
« no previous file with comments | « chrome/browser/history/url_database.h ('k') | chrome/browser/history/visit_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698