Fossil SCM

Do not allow the "." character inside of FTS5 search strings.

drh 2023-05-27 15:48 trunk
Commit 8a7609b11e31dbfe5ad5d77de762655c09d4783bb50706b38796ca03b413225c
1 file changed +1 -1
+1 -1
--- src/search.c
+++ src/search.c
@@ -926,11 +926,11 @@
926926
static const char *zSnippetCall;
927927
if( srchFlags==0 ) return;
928928
sqlite3_create_function(g.db, "rank", 1, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
929929
search_rank_sqlfunc, 0, 0);
930930
for(i=0; zPat[i]; i++){
931
- if( zPat[i]=='-' || zPat[i]=='"' ) zPat[i] = ' ';
931
+ if( zPat[i]=='-' || zPat[i]=='"' zPat[i]=='.' ) zPat[i] = ' ';
932932
}
933933
blob_init(&sql, 0, 0);
934934
if( search_index_type(0)==4 ){
935935
/* If this repo is still using the legacy FTS4 search index, then
936936
** the snippet() function is slightly different */
937937
--- src/search.c
+++ src/search.c
@@ -926,11 +926,11 @@
926 static const char *zSnippetCall;
927 if( srchFlags==0 ) return;
928 sqlite3_create_function(g.db, "rank", 1, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
929 search_rank_sqlfunc, 0, 0);
930 for(i=0; zPat[i]; i++){
931 if( zPat[i]=='-' || zPat[i]=='"' ) zPat[i] = ' ';
932 }
933 blob_init(&sql, 0, 0);
934 if( search_index_type(0)==4 ){
935 /* If this repo is still using the legacy FTS4 search index, then
936 ** the snippet() function is slightly different */
937
--- src/search.c
+++ src/search.c
@@ -926,11 +926,11 @@
926 static const char *zSnippetCall;
927 if( srchFlags==0 ) return;
928 sqlite3_create_function(g.db, "rank", 1, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
929 search_rank_sqlfunc, 0, 0);
930 for(i=0; zPat[i]; i++){
931 if( zPat[i]=='-' || zPat[i]=='"' zPat[i]=='.' ) zPat[i] = ' ';
932 }
933 blob_init(&sql, 0, 0);
934 if( search_index_type(0)==4 ){
935 /* If this repo is still using the legacy FTS4 search index, then
936 ** the snippet() function is slightly different */
937

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button