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

Unified Diff: third_party/sqlite/fts2.c

Issue 14176: Change sqlite fts2 tokenizer to recognize "foo*" as a prefix search, and not... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/fts2.c
===================================================================
--- third_party/sqlite/fts2.c (revision 7052)
+++ third_party/sqlite/fts2.c (working copy)
@@ -3538,6 +3538,7 @@
int firstIndex = pQuery->nTerms;
int iCol;
int nTerm = 1;
+ int iEndLast = -1;
int rc = pModule->xOpen(pTokenizer, pSegment, nSegment, &pCursor);
if( rc!=SQLITE_OK ) return rc;
@@ -3566,12 +3567,13 @@
// If a tokenizer recognizes "*" as a separate word, we mark the word
// before it as a prefix search. The other isPrefix code below that tests
// for a word that's tokenized with the star as its last character.
- // TODO(evanm): this is incorrect in that "foo *" parses as "foo*".
- if( pQuery->nTerms>0 && nToken==1 && pSegment[iBegin]=='*' ){
+ if( pQuery->nTerms>0 && nToken==1 && pSegment[iBegin]=='*' &&
+ iEndLast==iBegin){
Evan Martin 2008/12/17 00:28:11 tabbing off here? is iEndLast supposed to be one
Matt Perry 2008/12/17 00:29:58 fixed.. though there doesn't seem to be a consiste
pQuery->pTerms[pQuery->nTerms-1].isPrefix = 1;
continue;
}
-
+ iEndLast = iEnd;
+
queryAdd(pQuery, pToken, nToken);
if( !inPhrase && iBegin>0 && pSegment[iBegin-1]=='-' ){
pQuery->pTerms[pQuery->nTerms-1].isNot = 1;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698