diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-17 00:50:50 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-17 00:50:50 +0000 |
commit | b72bd2f78da3a1d78afc8e307645939b9a539417 (patch) | |
tree | da2fef81193e394cb04096d55975b2eb0b0fe902 /third_party | |
parent | c8a1cceb93d21e481a6e033fb4b725a133337557 (diff) | |
download | chromium_src-b72bd2f78da3a1d78afc8e307645939b9a539417.zip chromium_src-b72bd2f78da3a1d78afc8e307645939b9a539417.tar.gz chromium_src-b72bd2f78da3a1d78afc8e307645939b9a539417.tar.bz2 |
Change sqlite fts2 tokenizer to recognize "foo*" as a prefix search, and not
"foo *".
Review URL: http://codereview.chromium.org/14176
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/sqlite/fts2.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/third_party/sqlite/fts2.c b/third_party/sqlite/fts2.c index d882b4f..15ed0b5 100644 --- a/third_party/sqlite/fts2.c +++ b/third_party/sqlite/fts2.c @@ -3538,6 +3538,7 @@ static int tokenizeSegment( 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 @@ static int tokenizeSegment( // 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){ 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; |