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

Unified Diff: components/query_parser/query_parser.h

Issue 701553002: Allow systematic prefix search in bookmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/query_parser/query_parser.h
diff --git a/components/query_parser/query_parser.h b/components/query_parser/query_parser.h
index cc3f94b2cf3bc68f3353961b3bbe1c854dfa228d..1da0bbeeebe29a791d47ced6bcc6f94b1a628623 100644
--- a/components/query_parser/query_parser.h
+++ b/components/query_parser/query_parser.h
@@ -76,19 +76,23 @@ class QueryParser {
// Parse a query into a SQLite query. The resulting query is placed in
// |sqlite_query| and the number of words is returned.
- int ParseQuery(const base::string16& query, base::string16* sqlite_query);
+ int ParseQuery(const base::string16& query,
+ bool always_prefix_search,
+ base::string16* sqlite_query);
// Parses |query|, returning the words that make up it. Any words in quotes
// are put in |words| without the quotes. For example, the query text
// "foo bar" results in two entries being added to words, one for foo and one
// for bar.
void ParseQueryWords(const base::string16& query,
+ bool always_prefix_search,
std::vector<base::string16>* words);
// Parses |query|, returning the nodes that constitute the valid words in the
// query. This is intended for later usage with DoesQueryMatch. Ownership of
// the nodes passes to the caller.
void ParseQueryNodes(const base::string16& query,
+ bool always_prefix_search,
QueryNodeStarVector* nodes);
// Returns true if the string text matches the query nodes created by a call
@@ -114,7 +118,14 @@ class QueryParser {
private:
// Does the work of parsing |query|; creates nodes in |root| as appropriate.
// This is invoked from both of the ParseQuery methods.
- bool ParseQueryImpl(const base::string16& query, QueryNodeList* root);
+ // When |always_search_prefix| is true, no words are short enough for being
+ // considered for a prefix search.
+ // When |always_search_prefix| is false, only words long enough in terms of
+ // |IsWordLongEnoughForPrefixSearch| are considered for prefix search. The
+ // shorter words are then only considered for exact matches.
+ bool ParseQueryImpl(const base::string16& query,
+ bool always_search_prefix,
+ QueryNodeList* root);
DISALLOW_COPY_AND_ASSIGN(QueryParser);
};

Powered by Google App Engine
This is Rietveld 408576698