Fossil SCM

Improvements to the "fossil fts-config" command so that "enable" and "disable" subcommands accept symbolic names for the search catagories, rather than cryptic code letters. Always allow help-search even if disabled; just don't advertise the capability.

drh 2025-02-26 15:48 help-search
Commit 7ea128dd518b03f5186cf11e9a37006287b3deab8cb8f32c5bae5d56deb944ea
+6 -6
--- src/dispatch.c
+++ src/dispatch.c
@@ -832,11 +832,11 @@
832832
833833
style_set_current_feature("tkt");
834834
style_header("Help: %s", zCmd);
835835
836836
style_submenu_element("Command-List", "%R/help");
837
- if( search_restrict(SRCH_HELP)!=0 ){
837
+ if( search_restrict(SRCH_HELP,0)!=0 ){
838838
style_submenu_element("Search","%R/search?y=h");
839839
}
840840
rc = dispatch_name_search(zCmd, CMDFLAG_ANY|CMDFLAG_PREFIX, &pCmd);
841841
if( *zCmd=='/' ){
842842
/* Some of the webpages require query parameters in order to work.
@@ -1274,15 +1274,15 @@
12741274
n = dispatch_approx_match(g.argv[2], 5, az);
12751275
for(i=0; i<n; i++){
12761276
fossil_print(" * %s\n", az[i]);
12771277
}
12781278
fossil_print("Also consider using:\n");
1279
- fossil_print(" fossil help TOPIC ;# show help on TOPIC\n");
1280
- fossil_print(" fossil help -a ;# show all commands\n");
1281
- fossil_print(" fossil help -w ;# show all web-pages\n");
1282
- fossil_print(" fossil help -s ;# show all settings\n");
1283
- fossil_print(" fossil help -o ;# show global options\n");
1279
+ fossil_print(" fossil search -h PATTERN ;# search all help text\n");
1280
+ fossil_print(" fossil help -a ;# show all commands\n");
1281
+ fossil_print(" fossil help -w ;# show all web-pages\n");
1282
+ fossil_print(" fossil help -s ;# show all settings\n");
1283
+ fossil_print(" fossil help -o ;# show global options\n");
12841284
fossil_exit(1);
12851285
}
12861286
z = pCmd->zHelp;
12871287
if( z==0 ){
12881288
fossil_fatal("no help available for the %s %s",
12891289
--- src/dispatch.c
+++ src/dispatch.c
@@ -832,11 +832,11 @@
832
833 style_set_current_feature("tkt");
834 style_header("Help: %s", zCmd);
835
836 style_submenu_element("Command-List", "%R/help");
837 if( search_restrict(SRCH_HELP)!=0 ){
838 style_submenu_element("Search","%R/search?y=h");
839 }
840 rc = dispatch_name_search(zCmd, CMDFLAG_ANY|CMDFLAG_PREFIX, &pCmd);
841 if( *zCmd=='/' ){
842 /* Some of the webpages require query parameters in order to work.
@@ -1274,15 +1274,15 @@
1274 n = dispatch_approx_match(g.argv[2], 5, az);
1275 for(i=0; i<n; i++){
1276 fossil_print(" * %s\n", az[i]);
1277 }
1278 fossil_print("Also consider using:\n");
1279 fossil_print(" fossil help TOPIC ;# show help on TOPIC\n");
1280 fossil_print(" fossil help -a ;# show all commands\n");
1281 fossil_print(" fossil help -w ;# show all web-pages\n");
1282 fossil_print(" fossil help -s ;# show all settings\n");
1283 fossil_print(" fossil help -o ;# show global options\n");
1284 fossil_exit(1);
1285 }
1286 z = pCmd->zHelp;
1287 if( z==0 ){
1288 fossil_fatal("no help available for the %s %s",
1289
--- src/dispatch.c
+++ src/dispatch.c
@@ -832,11 +832,11 @@
832
833 style_set_current_feature("tkt");
834 style_header("Help: %s", zCmd);
835
836 style_submenu_element("Command-List", "%R/help");
837 if( search_restrict(SRCH_HELP,0)!=0 ){
838 style_submenu_element("Search","%R/search?y=h");
839 }
840 rc = dispatch_name_search(zCmd, CMDFLAG_ANY|CMDFLAG_PREFIX, &pCmd);
841 if( *zCmd=='/' ){
842 /* Some of the webpages require query parameters in order to work.
@@ -1274,15 +1274,15 @@
1274 n = dispatch_approx_match(g.argv[2], 5, az);
1275 for(i=0; i<n; i++){
1276 fossil_print(" * %s\n", az[i]);
1277 }
1278 fossil_print("Also consider using:\n");
1279 fossil_print(" fossil search -h PATTERN ;# search all help text\n");
1280 fossil_print(" fossil help -a ;# show all commands\n");
1281 fossil_print(" fossil help -w ;# show all web-pages\n");
1282 fossil_print(" fossil help -s ;# show all settings\n");
1283 fossil_print(" fossil help -o ;# show global options\n");
1284 fossil_exit(1);
1285 }
1286 z = pCmd->zHelp;
1287 if( z==0 ){
1288 fossil_fatal("no help available for the %s %s",
1289
+1 -1
--- src/forum.c
+++ src/forum.c
@@ -1927,11 +1927,11 @@
19271927
int srchFlags;
19281928
const int isSearch = P("s")!=0;
19291929
char const *zLimit = 0;
19301930
19311931
login_check_credentials();
1932
- srchFlags = search_restrict(SRCH_FORUM);
1932
+ srchFlags = search_restrict(SRCH_FORUM,0);
19331933
if( !g.perm.RdForum ){
19341934
login_needed(g.anon.RdForum);
19351935
return;
19361936
}
19371937
cgi_check_for_malice();
19381938
--- src/forum.c
+++ src/forum.c
@@ -1927,11 +1927,11 @@
1927 int srchFlags;
1928 const int isSearch = P("s")!=0;
1929 char const *zLimit = 0;
1930
1931 login_check_credentials();
1932 srchFlags = search_restrict(SRCH_FORUM);
1933 if( !g.perm.RdForum ){
1934 login_needed(g.anon.RdForum);
1935 return;
1936 }
1937 cgi_check_for_malice();
1938
--- src/forum.c
+++ src/forum.c
@@ -1927,11 +1927,11 @@
1927 int srchFlags;
1928 const int isSearch = P("s")!=0;
1929 char const *zLimit = 0;
1930
1931 login_check_credentials();
1932 srchFlags = search_restrict(SRCH_FORUM,0);
1933 if( !g.perm.RdForum ){
1934 login_needed(g.anon.RdForum);
1935 return;
1936 }
1937 cgi_check_for_malice();
1938
+49 -15
--- src/search.c
+++ src/search.c
@@ -739,11 +739,11 @@
739739
740740
db_find_and_open_repository(0, 0);
741741
verify_all_options();
742742
if( g.argc<3 ) return;
743743
login_set_capabilities("s", 0);
744
- if( search_restrict(srchFlags)==0 ){
744
+ if( search_restrict(srchFlags, 1)==0 ){
745745
fossil_print(
746746
"Search is disabled on this repository.\n"
747747
"Use the \"fossil fts-config\" command to enable.\n"
748748
);
749749
return;
@@ -849,12 +849,15 @@
849849
850850
/*
851851
** Remove bits from srchFlags which are disallowed by either the
852852
** current server configuration or by user permissions. Return
853853
** the revised search flags mask.
854
+**
855
+** If bFlex is true, that means allow through the SRCH_HELP option
856
+** even if it is not explicitly enabled.
854857
*/
855
-unsigned int search_restrict(unsigned int srchFlags){
858
+unsigned int search_restrict(unsigned int srchFlags, int bFlex){
856859
static unsigned int knownGood = 0;
857860
static unsigned int knownBad = 0;
858861
static const struct { unsigned m; const char *zKey; } aSetng[] = {
859862
{ SRCH_CKIN, "search-ci" },
860863
{ SRCH_DOC, "search-doc" },
@@ -877,10 +880,11 @@
877880
knownGood |= m;
878881
}else{
879882
knownBad |= m;
880883
}
881884
}
885
+ if( bFlex ) knownBad &= ~SRCH_HELP;
882886
return srchFlags & ~knownBad;
883887
}
884888
885889
/*
886890
** When this routine is called, there already exists a table
@@ -1283,11 +1287,11 @@
12831287
int nLimit = db_get_int("search-limit", 100);
12841288
12851289
if( P("searchlimit")!=0 ){
12861290
nLimit = atoi(P("searchlimit"));
12871291
}
1288
- srchFlags = search_restrict(srchFlags);
1292
+ srchFlags = search_restrict(srchFlags, 1);
12891293
if( srchFlags==0 ) return 0;
12901294
search_sql_setup(g.db);
12911295
add_content_sql_commands(g.db);
12921296
db_multi_exec(
12931297
"CREATE TEMP TABLE x(label,url,score,id,date,snip);"
@@ -1360,11 +1364,11 @@
13601364
const char *zDisable1;
13611365
const char *zDisable2;
13621366
const char *zPattern;
13631367
int fDebug = PB("debug");
13641368
int haveResult = 0;
1365
- srchFlags = search_restrict(srchFlags);
1369
+ srchFlags = search_restrict(srchFlags, 0);
13661370
switch( srchFlags ){
13671371
case SRCH_CKIN: zType = " Check-ins"; zClass = "Ckin"; break;
13681372
case SRCH_DOC: zType = " Docs"; zClass = "Doc"; break;
13691373
case SRCH_TKT: zType = " Tickets"; zClass = "Tkt"; break;
13701374
case SRCH_WIKI: zType = " Wiki"; zClass = "Wiki"; break;
@@ -2232,11 +2236,11 @@
22322236
void search_rebuild_index(void){
22332237
fossil_print("rebuilding the search index...");
22342238
fflush(stdout);
22352239
search_create_index();
22362240
search_fill_index();
2237
- search_update_index(search_restrict(SRCH_ALL));
2241
+ search_update_index(search_restrict(SRCH_ALL, 0));
22382242
if( db_table_exists("repository","chat") ){
22392243
chat_rebuild_index(1);
22402244
}
22412245
fossil_print(" done\n");
22422246
}
@@ -2252,15 +2256,15 @@
22522256
** reindex Rebuild the search index. This is a no-op if
22532257
** index search is disabled
22542258
**
22552259
** index (on|off) Turn the search index on or off
22562260
**
2257
-** enable cdtwefh Enable various kinds of search. c=Check-ins,
2258
-** d=Documents, t=Tickets, w=Wiki, e=Tech Notes,
2259
-** f=Forum, h=built-in-help.
2261
+** enable TYPE .. Enable search for TYPE. TYPE is one of:
2262
+** check-in, document, ticket, wiki, technote,
2263
+** forum, help, or all
22602264
**
2261
-** disable cdtwefh Disable various kinds of search
2265
+** disable TYPE ... Disable search for TYPE
22622266
**
22632267
** tokenizer VALUE Select a tokenizer for indexed search. VALUE
22642268
** may be one of (porter, on, off, trigram, unicode61),
22652269
** and "on" is equivalent to "porter". Unindexed
22662270
** search never uses tokenization or stemming.
@@ -2286,11 +2290,11 @@
22862290
} aSetng[] = {
22872291
{ "search-ci", "check-in search:", "c" },
22882292
{ "search-doc", "document search:", "d" },
22892293
{ "search-tkt", "ticket search:", "t" },
22902294
{ "search-wiki", "wiki search:", "w" },
2291
- { "search-technote", "tech note search:", "e" },
2295
+ { "search-technote", "technote search:", "e" },
22922296
{ "search-forum", "forum search:", "f" },
22932297
{ "search-help", "built-in help search:", "h" },
22942298
};
22952299
char *zSubCmd = 0;
22962300
int i, j, n;
@@ -2325,16 +2329,46 @@
23252329
}
23262330
db_begin_transaction();
23272331
23282332
/* Adjust search settings */
23292333
if( iCmd==3 || iCmd==4 ){
2334
+ int k;
23302335
const char *zCtrl;
2331
- if( g.argc<4 ) usage(mprintf("%s STRING",zSubCmd));
2332
- zCtrl = g.argv[3];
2333
- for(j=0; j<count(aSetng); j++){
2334
- if( strchr(zCtrl, aSetng[j].zSw[0])!=0 ){
2335
- db_set_int(aSetng[j].zSetting/*works-like:"x"*/, iCmd-3, 0);
2336
+ for(k=2; k<g.argc; k++){
2337
+ if( k==2 ){
2338
+ if( g.argc<4 ){
2339
+ zCtrl = "all";
2340
+ }else{
2341
+ zCtrl = g.argv[3];
2342
+ k++;
2343
+ }
2344
+ }else{
2345
+ zCtrl = g.argv[k];
2346
+ }
2347
+ if( fossil_strcmp(zCtrl,"all")==0 ){
2348
+ zCtrl = "cdtwefh";
2349
+ }
2350
+ if( strlen(zCtrl)>=4 ){
2351
+ /* If the argument to "enable" or "disable" is a string of at least
2352
+ ** 4 characters which matches part of any aSetng.zName, then use that
2353
+ ** one aSetng value only. */
2354
+ char *zGlob = mprintf("*%s*", zCtrl);
2355
+ for(j=0; j<count(aSetng); j++){
2356
+ if( sqlite3_strglob(zGlob, aSetng[j].zName)==0 ){
2357
+ db_set_int(aSetng[j].zSetting/*works-like:"x"*/, iCmd-3, 0);
2358
+ zCtrl = 0;
2359
+ break;
2360
+ }
2361
+ }
2362
+ fossil_free(zGlob);
2363
+ }
2364
+ if( zCtrl ){
2365
+ for(j=0; j<count(aSetng); j++){
2366
+ if( strchr(zCtrl, aSetng[j].zSw[0])!=0 ){
2367
+ db_set_int(aSetng[j].zSetting/*works-like:"x"*/, iCmd-3, 0);
2368
+ }
2369
+ }
23362370
}
23372371
}
23382372
}else if( iCmd==5 ){
23392373
int iOldTokenizer, iNewTokenizer;
23402374
if( g.argc<4 ) usage("tokenizer porter|on|off|trigram|unicode61");
23412375
--- src/search.c
+++ src/search.c
@@ -739,11 +739,11 @@
739
740 db_find_and_open_repository(0, 0);
741 verify_all_options();
742 if( g.argc<3 ) return;
743 login_set_capabilities("s", 0);
744 if( search_restrict(srchFlags)==0 ){
745 fossil_print(
746 "Search is disabled on this repository.\n"
747 "Use the \"fossil fts-config\" command to enable.\n"
748 );
749 return;
@@ -849,12 +849,15 @@
849
850 /*
851 ** Remove bits from srchFlags which are disallowed by either the
852 ** current server configuration or by user permissions. Return
853 ** the revised search flags mask.
 
 
 
854 */
855 unsigned int search_restrict(unsigned int srchFlags){
856 static unsigned int knownGood = 0;
857 static unsigned int knownBad = 0;
858 static const struct { unsigned m; const char *zKey; } aSetng[] = {
859 { SRCH_CKIN, "search-ci" },
860 { SRCH_DOC, "search-doc" },
@@ -877,10 +880,11 @@
877 knownGood |= m;
878 }else{
879 knownBad |= m;
880 }
881 }
 
882 return srchFlags & ~knownBad;
883 }
884
885 /*
886 ** When this routine is called, there already exists a table
@@ -1283,11 +1287,11 @@
1283 int nLimit = db_get_int("search-limit", 100);
1284
1285 if( P("searchlimit")!=0 ){
1286 nLimit = atoi(P("searchlimit"));
1287 }
1288 srchFlags = search_restrict(srchFlags);
1289 if( srchFlags==0 ) return 0;
1290 search_sql_setup(g.db);
1291 add_content_sql_commands(g.db);
1292 db_multi_exec(
1293 "CREATE TEMP TABLE x(label,url,score,id,date,snip);"
@@ -1360,11 +1364,11 @@
1360 const char *zDisable1;
1361 const char *zDisable2;
1362 const char *zPattern;
1363 int fDebug = PB("debug");
1364 int haveResult = 0;
1365 srchFlags = search_restrict(srchFlags);
1366 switch( srchFlags ){
1367 case SRCH_CKIN: zType = " Check-ins"; zClass = "Ckin"; break;
1368 case SRCH_DOC: zType = " Docs"; zClass = "Doc"; break;
1369 case SRCH_TKT: zType = " Tickets"; zClass = "Tkt"; break;
1370 case SRCH_WIKI: zType = " Wiki"; zClass = "Wiki"; break;
@@ -2232,11 +2236,11 @@
2232 void search_rebuild_index(void){
2233 fossil_print("rebuilding the search index...");
2234 fflush(stdout);
2235 search_create_index();
2236 search_fill_index();
2237 search_update_index(search_restrict(SRCH_ALL));
2238 if( db_table_exists("repository","chat") ){
2239 chat_rebuild_index(1);
2240 }
2241 fossil_print(" done\n");
2242 }
@@ -2252,15 +2256,15 @@
2252 ** reindex Rebuild the search index. This is a no-op if
2253 ** index search is disabled
2254 **
2255 ** index (on|off) Turn the search index on or off
2256 **
2257 ** enable cdtwefh Enable various kinds of search. c=Check-ins,
2258 ** d=Documents, t=Tickets, w=Wiki, e=Tech Notes,
2259 ** f=Forum, h=built-in-help.
2260 **
2261 ** disable cdtwefh Disable various kinds of search
2262 **
2263 ** tokenizer VALUE Select a tokenizer for indexed search. VALUE
2264 ** may be one of (porter, on, off, trigram, unicode61),
2265 ** and "on" is equivalent to "porter". Unindexed
2266 ** search never uses tokenization or stemming.
@@ -2286,11 +2290,11 @@
2286 } aSetng[] = {
2287 { "search-ci", "check-in search:", "c" },
2288 { "search-doc", "document search:", "d" },
2289 { "search-tkt", "ticket search:", "t" },
2290 { "search-wiki", "wiki search:", "w" },
2291 { "search-technote", "tech note search:", "e" },
2292 { "search-forum", "forum search:", "f" },
2293 { "search-help", "built-in help search:", "h" },
2294 };
2295 char *zSubCmd = 0;
2296 int i, j, n;
@@ -2325,16 +2329,46 @@
2325 }
2326 db_begin_transaction();
2327
2328 /* Adjust search settings */
2329 if( iCmd==3 || iCmd==4 ){
 
2330 const char *zCtrl;
2331 if( g.argc<4 ) usage(mprintf("%s STRING",zSubCmd));
2332 zCtrl = g.argv[3];
2333 for(j=0; j<count(aSetng); j++){
2334 if( strchr(zCtrl, aSetng[j].zSw[0])!=0 ){
2335 db_set_int(aSetng[j].zSetting/*works-like:"x"*/, iCmd-3, 0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2336 }
2337 }
2338 }else if( iCmd==5 ){
2339 int iOldTokenizer, iNewTokenizer;
2340 if( g.argc<4 ) usage("tokenizer porter|on|off|trigram|unicode61");
2341
--- src/search.c
+++ src/search.c
@@ -739,11 +739,11 @@
739
740 db_find_and_open_repository(0, 0);
741 verify_all_options();
742 if( g.argc<3 ) return;
743 login_set_capabilities("s", 0);
744 if( search_restrict(srchFlags, 1)==0 ){
745 fossil_print(
746 "Search is disabled on this repository.\n"
747 "Use the \"fossil fts-config\" command to enable.\n"
748 );
749 return;
@@ -849,12 +849,15 @@
849
850 /*
851 ** Remove bits from srchFlags which are disallowed by either the
852 ** current server configuration or by user permissions. Return
853 ** the revised search flags mask.
854 **
855 ** If bFlex is true, that means allow through the SRCH_HELP option
856 ** even if it is not explicitly enabled.
857 */
858 unsigned int search_restrict(unsigned int srchFlags, int bFlex){
859 static unsigned int knownGood = 0;
860 static unsigned int knownBad = 0;
861 static const struct { unsigned m; const char *zKey; } aSetng[] = {
862 { SRCH_CKIN, "search-ci" },
863 { SRCH_DOC, "search-doc" },
@@ -877,10 +880,11 @@
880 knownGood |= m;
881 }else{
882 knownBad |= m;
883 }
884 }
885 if( bFlex ) knownBad &= ~SRCH_HELP;
886 return srchFlags & ~knownBad;
887 }
888
889 /*
890 ** When this routine is called, there already exists a table
@@ -1283,11 +1287,11 @@
1287 int nLimit = db_get_int("search-limit", 100);
1288
1289 if( P("searchlimit")!=0 ){
1290 nLimit = atoi(P("searchlimit"));
1291 }
1292 srchFlags = search_restrict(srchFlags, 1);
1293 if( srchFlags==0 ) return 0;
1294 search_sql_setup(g.db);
1295 add_content_sql_commands(g.db);
1296 db_multi_exec(
1297 "CREATE TEMP TABLE x(label,url,score,id,date,snip);"
@@ -1360,11 +1364,11 @@
1364 const char *zDisable1;
1365 const char *zDisable2;
1366 const char *zPattern;
1367 int fDebug = PB("debug");
1368 int haveResult = 0;
1369 srchFlags = search_restrict(srchFlags, 0);
1370 switch( srchFlags ){
1371 case SRCH_CKIN: zType = " Check-ins"; zClass = "Ckin"; break;
1372 case SRCH_DOC: zType = " Docs"; zClass = "Doc"; break;
1373 case SRCH_TKT: zType = " Tickets"; zClass = "Tkt"; break;
1374 case SRCH_WIKI: zType = " Wiki"; zClass = "Wiki"; break;
@@ -2232,11 +2236,11 @@
2236 void search_rebuild_index(void){
2237 fossil_print("rebuilding the search index...");
2238 fflush(stdout);
2239 search_create_index();
2240 search_fill_index();
2241 search_update_index(search_restrict(SRCH_ALL, 0));
2242 if( db_table_exists("repository","chat") ){
2243 chat_rebuild_index(1);
2244 }
2245 fossil_print(" done\n");
2246 }
@@ -2252,15 +2256,15 @@
2256 ** reindex Rebuild the search index. This is a no-op if
2257 ** index search is disabled
2258 **
2259 ** index (on|off) Turn the search index on or off
2260 **
2261 ** enable TYPE .. Enable search for TYPE. TYPE is one of:
2262 ** check-in, document, ticket, wiki, technote,
2263 ** forum, help, or all
2264 **
2265 ** disable TYPE ... Disable search for TYPE
2266 **
2267 ** tokenizer VALUE Select a tokenizer for indexed search. VALUE
2268 ** may be one of (porter, on, off, trigram, unicode61),
2269 ** and "on" is equivalent to "porter". Unindexed
2270 ** search never uses tokenization or stemming.
@@ -2286,11 +2290,11 @@
2290 } aSetng[] = {
2291 { "search-ci", "check-in search:", "c" },
2292 { "search-doc", "document search:", "d" },
2293 { "search-tkt", "ticket search:", "t" },
2294 { "search-wiki", "wiki search:", "w" },
2295 { "search-technote", "technote search:", "e" },
2296 { "search-forum", "forum search:", "f" },
2297 { "search-help", "built-in help search:", "h" },
2298 };
2299 char *zSubCmd = 0;
2300 int i, j, n;
@@ -2325,16 +2329,46 @@
2329 }
2330 db_begin_transaction();
2331
2332 /* Adjust search settings */
2333 if( iCmd==3 || iCmd==4 ){
2334 int k;
2335 const char *zCtrl;
2336 for(k=2; k<g.argc; k++){
2337 if( k==2 ){
2338 if( g.argc<4 ){
2339 zCtrl = "all";
2340 }else{
2341 zCtrl = g.argv[3];
2342 k++;
2343 }
2344 }else{
2345 zCtrl = g.argv[k];
2346 }
2347 if( fossil_strcmp(zCtrl,"all")==0 ){
2348 zCtrl = "cdtwefh";
2349 }
2350 if( strlen(zCtrl)>=4 ){
2351 /* If the argument to "enable" or "disable" is a string of at least
2352 ** 4 characters which matches part of any aSetng.zName, then use that
2353 ** one aSetng value only. */
2354 char *zGlob = mprintf("*%s*", zCtrl);
2355 for(j=0; j<count(aSetng); j++){
2356 if( sqlite3_strglob(zGlob, aSetng[j].zName)==0 ){
2357 db_set_int(aSetng[j].zSetting/*works-like:"x"*/, iCmd-3, 0);
2358 zCtrl = 0;
2359 break;
2360 }
2361 }
2362 fossil_free(zGlob);
2363 }
2364 if( zCtrl ){
2365 for(j=0; j<count(aSetng); j++){
2366 if( strchr(zCtrl, aSetng[j].zSw[0])!=0 ){
2367 db_set_int(aSetng[j].zSetting/*works-like:"x"*/, iCmd-3, 0);
2368 }
2369 }
2370 }
2371 }
2372 }else if( iCmd==5 ){
2373 int iOldTokenizer, iNewTokenizer;
2374 if( g.argc<4 ) usage("tokenizer porter|on|off|trigram|unicode61");
2375
+1 -1
--- src/setup.c
+++ src/setup.c
@@ -2264,11 +2264,11 @@
22642264
const char *zTokenizer = PD("ftstok","off");
22652265
search_set_tokenizer(zTokenizer);
22662266
search_drop_index();
22672267
search_create_index();
22682268
search_fill_index();
2269
- search_update_index(search_restrict(SRCH_ALL));
2269
+ search_update_index(search_restrict(SRCH_ALL,0));
22702270
}
22712271
if( search_index_exists() ){
22722272
int pgsz = db_int64(0, "PRAGMA repository.page_size;");
22732273
i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
22742274
i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
22752275
--- src/setup.c
+++ src/setup.c
@@ -2264,11 +2264,11 @@
2264 const char *zTokenizer = PD("ftstok","off");
2265 search_set_tokenizer(zTokenizer);
2266 search_drop_index();
2267 search_create_index();
2268 search_fill_index();
2269 search_update_index(search_restrict(SRCH_ALL));
2270 }
2271 if( search_index_exists() ){
2272 int pgsz = db_int64(0, "PRAGMA repository.page_size;");
2273 i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
2274 i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
2275
--- src/setup.c
+++ src/setup.c
@@ -2264,11 +2264,11 @@
2264 const char *zTokenizer = PD("ftstok","off");
2265 search_set_tokenizer(zTokenizer);
2266 search_drop_index();
2267 search_create_index();
2268 search_fill_index();
2269 search_update_index(search_restrict(SRCH_ALL,0));
2270 }
2271 if( search_index_exists() ){
2272 int pgsz = db_int64(0, "PRAGMA repository.page_size;");
2273 i64 nTotal = db_int64(0, "PRAGMA repository.page_count;")*pgsz;
2274 i64 nFts = db_int64(0, "SELECT count(*) FROM dbstat"
2275
+1 -1
--- src/sitemap.c
+++ src/sitemap.c
@@ -64,11 +64,11 @@
6464
** then disable anti-robot defenses */
6565
isPopup = 1;
6666
g.perm.Hyperlink = 1;
6767
g.jsHref = 0;
6868
}
69
- srchFlags = search_restrict(SRCH_ALL);
69
+ srchFlags = search_restrict(SRCH_ALL,0);
7070
if( !isPopup ){
7171
style_header("Site Map");
7272
style_adunit_config(ADUNIT_RIGHT_OK);
7373
}
7474
7575
--- src/sitemap.c
+++ src/sitemap.c
@@ -64,11 +64,11 @@
64 ** then disable anti-robot defenses */
65 isPopup = 1;
66 g.perm.Hyperlink = 1;
67 g.jsHref = 0;
68 }
69 srchFlags = search_restrict(SRCH_ALL);
70 if( !isPopup ){
71 style_header("Site Map");
72 style_adunit_config(ADUNIT_RIGHT_OK);
73 }
74
75
--- src/sitemap.c
+++ src/sitemap.c
@@ -64,11 +64,11 @@
64 ** then disable anti-robot defenses */
65 isPopup = 1;
66 g.perm.Hyperlink = 1;
67 g.jsHref = 0;
68 }
69 srchFlags = search_restrict(SRCH_ALL,0);
70 if( !isPopup ){
71 style_header("Site Map");
72 style_adunit_config(ADUNIT_RIGHT_OK);
73 }
74
75
+1 -1
--- src/th_main.c
+++ src/th_main.c
@@ -894,11 +894,11 @@
894894
int argc,
895895
const char **argv,
896896
int *argl
897897
){
898898
int rc = 1, i, j;
899
- unsigned int searchCap = search_restrict(SRCH_ALL);
899
+ unsigned int searchCap = search_restrict(SRCH_ALL, 0);
900900
if( argc<2 ){
901901
return Th_WrongNumArgs(interp, "hascap STRING ...");
902902
}
903903
for(i=1; i<argc && rc; i++){
904904
int match = 0;
905905
--- src/th_main.c
+++ src/th_main.c
@@ -894,11 +894,11 @@
894 int argc,
895 const char **argv,
896 int *argl
897 ){
898 int rc = 1, i, j;
899 unsigned int searchCap = search_restrict(SRCH_ALL);
900 if( argc<2 ){
901 return Th_WrongNumArgs(interp, "hascap STRING ...");
902 }
903 for(i=1; i<argc && rc; i++){
904 int match = 0;
905
--- src/th_main.c
+++ src/th_main.c
@@ -894,11 +894,11 @@
894 int argc,
895 const char **argv,
896 int *argl
897 ){
898 int rc = 1, i, j;
899 unsigned int searchCap = search_restrict(SRCH_ALL, 0);
900 if( argc<2 ){
901 return Th_WrongNumArgs(interp, "hascap STRING ...");
902 }
903 for(i=1; i<argc && rc; i++){
904 int match = 0;
905
+1 -1
--- src/timeline.c
+++ src/timeline.c
@@ -3005,11 +3005,11 @@
30053005
if( showSql ){
30063006
db_append_dml_to_blob(0);
30073007
@ <pre>%h(blob_str(&allSql))</pre>
30083008
blob_reset(&allSql);
30093009
}
3010
- if( search_restrict(SRCH_CKIN)!=0 ){
3010
+ if( search_restrict(SRCH_CKIN, 0)!=0 ){
30113011
style_submenu_element("Search", "%R/search?y=c");
30123012
}
30133013
if( advancedMenu ){
30143014
style_submenu_element("Basic", "%s",
30153015
url_render(&url, "advm", "0", "udc", "1"));
30163016
--- src/timeline.c
+++ src/timeline.c
@@ -3005,11 +3005,11 @@
3005 if( showSql ){
3006 db_append_dml_to_blob(0);
3007 @ <pre>%h(blob_str(&allSql))</pre>
3008 blob_reset(&allSql);
3009 }
3010 if( search_restrict(SRCH_CKIN)!=0 ){
3011 style_submenu_element("Search", "%R/search?y=c");
3012 }
3013 if( advancedMenu ){
3014 style_submenu_element("Basic", "%s",
3015 url_render(&url, "advm", "0", "udc", "1"));
3016
--- src/timeline.c
+++ src/timeline.c
@@ -3005,11 +3005,11 @@
3005 if( showSql ){
3006 db_append_dml_to_blob(0);
3007 @ <pre>%h(blob_str(&allSql))</pre>
3008 blob_reset(&allSql);
3009 }
3010 if( search_restrict(SRCH_CKIN, 0)!=0 ){
3011 style_submenu_element("Search", "%R/search?y=c");
3012 }
3013 if( advancedMenu ){
3014 style_submenu_element("Basic", "%s",
3015 url_render(&url, "advm", "0", "udc", "1"));
3016
+2 -2
--- src/tkt.c
+++ src/tkt.c
@@ -1855,11 +1855,11 @@
18551855
18561856
/*
18571857
** Add some standard submenu elements for ticket screens.
18581858
*/
18591859
void ticket_standard_submenu(unsigned int ok){
1860
- if( (ok & T_SRCH)!=0 && search_restrict(SRCH_TKT)!=0 ){
1860
+ if( (ok & T_SRCH)!=0 && search_restrict(SRCH_TKT, 0)!=0 ){
18611861
style_submenu_element("Search", "%R/tktsrch");
18621862
}
18631863
if( (ok & T_REPLIST)!=0 ){
18641864
style_submenu_element("Reports", "%R/reportlist");
18651865
}
@@ -1875,11 +1875,11 @@
18751875
** either ticket-search (if search is enabled) or as the
18761876
** /reportlist page (if ticket search is disabled).
18771877
*/
18781878
void tkt_home_page(void){
18791879
login_check_credentials();
1880
- if( search_restrict(SRCH_TKT)!=0 ){
1880
+ if( search_restrict(SRCH_TKT, 0)!=0 ){
18811881
tkt_srchpage();
18821882
}else{
18831883
view_list();
18841884
}
18851885
}
18861886
--- src/tkt.c
+++ src/tkt.c
@@ -1855,11 +1855,11 @@
1855
1856 /*
1857 ** Add some standard submenu elements for ticket screens.
1858 */
1859 void ticket_standard_submenu(unsigned int ok){
1860 if( (ok & T_SRCH)!=0 && search_restrict(SRCH_TKT)!=0 ){
1861 style_submenu_element("Search", "%R/tktsrch");
1862 }
1863 if( (ok & T_REPLIST)!=0 ){
1864 style_submenu_element("Reports", "%R/reportlist");
1865 }
@@ -1875,11 +1875,11 @@
1875 ** either ticket-search (if search is enabled) or as the
1876 ** /reportlist page (if ticket search is disabled).
1877 */
1878 void tkt_home_page(void){
1879 login_check_credentials();
1880 if( search_restrict(SRCH_TKT)!=0 ){
1881 tkt_srchpage();
1882 }else{
1883 view_list();
1884 }
1885 }
1886
--- src/tkt.c
+++ src/tkt.c
@@ -1855,11 +1855,11 @@
1855
1856 /*
1857 ** Add some standard submenu elements for ticket screens.
1858 */
1859 void ticket_standard_submenu(unsigned int ok){
1860 if( (ok & T_SRCH)!=0 && search_restrict(SRCH_TKT, 0)!=0 ){
1861 style_submenu_element("Search", "%R/tktsrch");
1862 }
1863 if( (ok & T_REPLIST)!=0 ){
1864 style_submenu_element("Reports", "%R/reportlist");
1865 }
@@ -1875,11 +1875,11 @@
1875 ** either ticket-search (if search is enabled) or as the
1876 ** /reportlist page (if ticket search is disabled).
1877 */
1878 void tkt_home_page(void){
1879 login_check_credentials();
1880 if( search_restrict(SRCH_TKT, 0)!=0 ){
1881 tkt_srchpage();
1882 }else{
1883 view_list();
1884 }
1885 }
1886
+3 -3
--- src/wiki.c
+++ src/wiki.c
@@ -332,11 +332,11 @@
332332
333333
/*
334334
** Add some standard submenu elements for wiki screens.
335335
*/
336336
static void wiki_standard_submenu(unsigned int ok){
337
- if( (ok & W_SRCH)!=0 && search_restrict(SRCH_WIKI)!=0 ){
337
+ if( (ok & W_SRCH)!=0 && search_restrict(SRCH_WIKI,0)!=0 ){
338338
style_submenu_element("Search", "%R/wikisrch");
339339
}
340340
if( (ok & W_LIST)!=0 ){
341341
style_submenu_element("List", "%R/wcontent");
342342
}
@@ -379,11 +379,11 @@
379379
@ <li> %z(href("%R/timeline?y=e"))List of All Tech-notes</a>
380380
@ available on this server.</li>
381381
if( g.perm.ModWiki ){
382382
@ <li> %z(href("%R/modreq"))Tend to pending moderation requests</a></li>
383383
}
384
- if( search_restrict(SRCH_WIKI)!=0 ){
384
+ if( search_restrict(SRCH_WIKI,0)!=0 ){
385385
@ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
386386
@ words</li>
387387
}
388388
@ </ul>
389389
style_finish_page();
@@ -561,11 +561,11 @@
561561
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
562562
zPageName = P("name");
563563
(void)P("s")/*for cgi_check_for_malice(). "s" == search stringy*/;
564564
cgi_check_for_malice();
565565
if( zPageName==0 ){
566
- if( search_restrict(SRCH_WIKI)!=0 ){
566
+ if( search_restrict(SRCH_WIKI,0)!=0 ){
567567
wiki_srchpage();
568568
}else{
569569
wiki_helppage();
570570
}
571571
return;
572572
--- src/wiki.c
+++ src/wiki.c
@@ -332,11 +332,11 @@
332
333 /*
334 ** Add some standard submenu elements for wiki screens.
335 */
336 static void wiki_standard_submenu(unsigned int ok){
337 if( (ok & W_SRCH)!=0 && search_restrict(SRCH_WIKI)!=0 ){
338 style_submenu_element("Search", "%R/wikisrch");
339 }
340 if( (ok & W_LIST)!=0 ){
341 style_submenu_element("List", "%R/wcontent");
342 }
@@ -379,11 +379,11 @@
379 @ <li> %z(href("%R/timeline?y=e"))List of All Tech-notes</a>
380 @ available on this server.</li>
381 if( g.perm.ModWiki ){
382 @ <li> %z(href("%R/modreq"))Tend to pending moderation requests</a></li>
383 }
384 if( search_restrict(SRCH_WIKI)!=0 ){
385 @ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
386 @ words</li>
387 }
388 @ </ul>
389 style_finish_page();
@@ -561,11 +561,11 @@
561 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
562 zPageName = P("name");
563 (void)P("s")/*for cgi_check_for_malice(). "s" == search stringy*/;
564 cgi_check_for_malice();
565 if( zPageName==0 ){
566 if( search_restrict(SRCH_WIKI)!=0 ){
567 wiki_srchpage();
568 }else{
569 wiki_helppage();
570 }
571 return;
572
--- src/wiki.c
+++ src/wiki.c
@@ -332,11 +332,11 @@
332
333 /*
334 ** Add some standard submenu elements for wiki screens.
335 */
336 static void wiki_standard_submenu(unsigned int ok){
337 if( (ok & W_SRCH)!=0 && search_restrict(SRCH_WIKI,0)!=0 ){
338 style_submenu_element("Search", "%R/wikisrch");
339 }
340 if( (ok & W_LIST)!=0 ){
341 style_submenu_element("List", "%R/wcontent");
342 }
@@ -379,11 +379,11 @@
379 @ <li> %z(href("%R/timeline?y=e"))List of All Tech-notes</a>
380 @ available on this server.</li>
381 if( g.perm.ModWiki ){
382 @ <li> %z(href("%R/modreq"))Tend to pending moderation requests</a></li>
383 }
384 if( search_restrict(SRCH_WIKI,0)!=0 ){
385 @ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
386 @ words</li>
387 }
388 @ </ul>
389 style_finish_page();
@@ -561,11 +561,11 @@
561 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
562 zPageName = P("name");
563 (void)P("s")/*for cgi_check_for_malice(). "s" == search stringy*/;
564 cgi_check_for_malice();
565 if( zPageName==0 ){
566 if( search_restrict(SRCH_WIKI,0)!=0 ){
567 wiki_srchpage();
568 }else{
569 wiki_helppage();
570 }
571 return;
572

Keyboard Shortcuts

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