Fossil

Check-in [196dfedf]
Login

Check-in [196dfedf]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not allow non-alpha numeric ascii characters into the search pattern. Convert all such characters into a single space.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 196dfedf7fc467cd98354fc9f163bae0f2a05c74850f0d4914ae7d4c6aa347e2
User & Date: drh 2023-05-27 15:54:02
References
2023-07-13
12:13
Reconcile a test in the FTS search with its original intent in [196dfedf7fc]; reported in forum post fa13ae06d. ... (check-in: e8821162 user: danield tags: trunk)
Context
2023-05-29
12:44
Enhance the /reports page to include sub-categories "Merge Check-ins" and "Non-merge Check-ins". ... (check-in: d4058f78 user: drh tags: trunk)
11:40
Enhance the /reports page to show two new sub-types of activities: "Merge Check-ins" and "Non-merge Check-ins". ... (check-in: 37a80fbf user: drh tags: non-merge-activity-report)
2023-05-27
15:54
Do not allow non-alpha numeric ascii characters into the search pattern. Convert all such characters into a single space. ... (check-in: 196dfedf user: drh tags: trunk)
15:02
Fix the captcha-audio page so that it works even without a seed value. ... (check-in: a1178d57 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/search.c.

924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
  char *zPat = mprintf("%s",zPattern);
  int i;
  static const char *zSnippetCall;
  if( srchFlags==0 ) return;
  sqlite3_create_function(g.db, "rank", 1, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
     search_rank_sqlfunc, 0, 0);
  for(i=0; zPat[i]; i++){
    if( zPat[i]=='-' || zPat[i]=='"' ) zPat[i] = ' ';
  }
  blob_init(&sql, 0, 0);
  if( search_index_type(0)==4 ){
    /* If this repo is still using the legacy FTS4 search index, then
    ** the snippet() function is slightly different */
    zSnippetCall = "snippet(ftsidx,'<mark>','</mark>',' ... ',-1,35)";
  }else{







|







924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
  char *zPat = mprintf("%s",zPattern);
  int i;
  static const char *zSnippetCall;
  if( srchFlags==0 ) return;
  sqlite3_create_function(g.db, "rank", 1, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
     search_rank_sqlfunc, 0, 0);
  for(i=0; zPat[i]; i++){
    if( (zPat[i]&0x80)!=0 || !fossil_isalnum(zPat[i]) ) zPat[i] = ' ';
  }
  blob_init(&sql, 0, 0);
  if( search_index_type(0)==4 ){
    /* If this repo is still using the legacy FTS4 search index, then
    ** the snippet() function is slightly different */
    zSnippetCall = "snippet(ftsidx,'<mark>','</mark>',' ... ',-1,35)";
  }else{