Fossil SCM

Minor comment fixes in the search logic. No changes to code.

drh 2020-04-04 18:03 trunk
Commit 4d351608666ae138087bfb4c61720000eaaa9b41edead85a332941f084104368
1 file changed +20 -4
+20 -4
--- src/search.c
+++ src/search.c
@@ -14,11 +14,12 @@
1414
** http://www.hwaci.com/drh/
1515
**
1616
*******************************************************************************
1717
**
1818
** This file contains code to implement a search functions
19
-** against timeline comments, check-in content, wiki pages, and/or tickets.
19
+** against timeline comments, check-in content, wiki pages, tickets,
20
+** and/or forum posts.
2021
**
2122
** The search can be either a per-query "grep"-like search that scans
2223
** the entire corpus. Or it can use the FTS4 or FTS5 search engine of
2324
** SQLite. The choice is a administrator configuration option.
2425
**
@@ -331,10 +332,18 @@
331332
**
332333
** Usage: %fossil test-match SEARCHSTRING FILE1 FILE2 ...
333334
**
334335
** Run the full-scan search algorithm using SEARCHSTRING against
335336
** the text of the files listed. Output matches and snippets.
337
+**
338
+** Options:
339
+**
340
+** --begin TEXT Text to insert before each match
341
+** --end TEXT Text to insert after each match
342
+** --gap TEXT Text to indicate elided content
343
+** --html Input is HTML
344
+** --static Use the static Search object
336345
*/
337346
void test_match_cmd(void){
338347
Search *p;
339348
int i;
340349
Blob x;
@@ -372,11 +381,12 @@
372381
**
373382
** All arguments are optional. PATTERN is the search pattern. If it
374383
** is omitted, then the global search pattern is reset. BEGIN and END
375384
** and GAP are the strings used to construct snippets. FLAGS is an
376385
** integer bit pattern containing the various SRCH_CKIN, SRCH_DOC,
377
-** SRCH_TKT, or SRCH_ALL bits to determine what is to be searched.
386
+** SRCH_TKT, SRCH_FORUM, or SRCH_ALL bits to determine what is to be
387
+** searched.
378388
*/
379389
static void search_init_sqlfunc(
380390
sqlite3_context *context,
381391
int argc,
382392
sqlite3_value **argv
@@ -407,11 +417,11 @@
407417
408418
/* search_match(TEXT, TEXT, ....)
409419
**
410420
** Using the full-scan search engine created by the most recent call
411421
** to search_init(), match the input the TEXT arguments.
412
-** Remember the results global full-scan search object.
422
+** Remember the results in the global full-scan search object.
413423
** Return non-zero on a match and zero on a miss.
414424
*/
415425
static void search_match_sqlfunc(
416426
sqlite3_context *context,
417427
int argc,
@@ -560,10 +570,15 @@
560570
** Usage: %fossil search [-all|-a] [-limit|-n #] [-width|-W #] pattern...
561571
**
562572
** Search for timeline entries matching all words provided on the
563573
** command line. Whole-word matches scope more highly than partial
564574
** matches.
575
+**
576
+** Note: The command only search the EVENT table. So it will only
577
+** display check-in comments or other comments that appear on an
578
+** unaugmented timeline. It does not search document text or forum
579
+** messages.
565580
**
566581
** Outputs, by default, some top-N fraction of the results. The -all
567582
** option can be used to output all matches, regardless of their search
568583
** score. The -limit option can be used to limit the number of entries
569584
** returned. The -width option can be used to set the output width used
@@ -645,11 +660,12 @@
645660
#define SRCH_ALL 0x003f /* Search over everything */
646661
#endif
647662
648663
/*
649664
** Remove bits from srchFlags which are disallowed by either the
650
-** current server configuration or by user permissions.
665
+** current server configuration or by user permissions. Return
666
+** the revised search flags mask.
651667
*/
652668
unsigned int search_restrict(unsigned int srchFlags){
653669
static unsigned int knownGood = 0;
654670
static unsigned int knownBad = 0;
655671
static const struct { unsigned m; const char *zKey; } aSetng[] = {
656672
--- src/search.c
+++ src/search.c
@@ -14,11 +14,12 @@
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file contains code to implement a search functions
19 ** against timeline comments, check-in content, wiki pages, and/or tickets.
 
20 **
21 ** The search can be either a per-query "grep"-like search that scans
22 ** the entire corpus. Or it can use the FTS4 or FTS5 search engine of
23 ** SQLite. The choice is a administrator configuration option.
24 **
@@ -331,10 +332,18 @@
331 **
332 ** Usage: %fossil test-match SEARCHSTRING FILE1 FILE2 ...
333 **
334 ** Run the full-scan search algorithm using SEARCHSTRING against
335 ** the text of the files listed. Output matches and snippets.
 
 
 
 
 
 
 
 
336 */
337 void test_match_cmd(void){
338 Search *p;
339 int i;
340 Blob x;
@@ -372,11 +381,12 @@
372 **
373 ** All arguments are optional. PATTERN is the search pattern. If it
374 ** is omitted, then the global search pattern is reset. BEGIN and END
375 ** and GAP are the strings used to construct snippets. FLAGS is an
376 ** integer bit pattern containing the various SRCH_CKIN, SRCH_DOC,
377 ** SRCH_TKT, or SRCH_ALL bits to determine what is to be searched.
 
378 */
379 static void search_init_sqlfunc(
380 sqlite3_context *context,
381 int argc,
382 sqlite3_value **argv
@@ -407,11 +417,11 @@
407
408 /* search_match(TEXT, TEXT, ....)
409 **
410 ** Using the full-scan search engine created by the most recent call
411 ** to search_init(), match the input the TEXT arguments.
412 ** Remember the results global full-scan search object.
413 ** Return non-zero on a match and zero on a miss.
414 */
415 static void search_match_sqlfunc(
416 sqlite3_context *context,
417 int argc,
@@ -560,10 +570,15 @@
560 ** Usage: %fossil search [-all|-a] [-limit|-n #] [-width|-W #] pattern...
561 **
562 ** Search for timeline entries matching all words provided on the
563 ** command line. Whole-word matches scope more highly than partial
564 ** matches.
 
 
 
 
 
565 **
566 ** Outputs, by default, some top-N fraction of the results. The -all
567 ** option can be used to output all matches, regardless of their search
568 ** score. The -limit option can be used to limit the number of entries
569 ** returned. The -width option can be used to set the output width used
@@ -645,11 +660,12 @@
645 #define SRCH_ALL 0x003f /* Search over everything */
646 #endif
647
648 /*
649 ** Remove bits from srchFlags which are disallowed by either the
650 ** current server configuration or by user permissions.
 
651 */
652 unsigned int search_restrict(unsigned int srchFlags){
653 static unsigned int knownGood = 0;
654 static unsigned int knownBad = 0;
655 static const struct { unsigned m; const char *zKey; } aSetng[] = {
656
--- src/search.c
+++ src/search.c
@@ -14,11 +14,12 @@
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file contains code to implement a search functions
19 ** against timeline comments, check-in content, wiki pages, tickets,
20 ** and/or forum posts.
21 **
22 ** The search can be either a per-query "grep"-like search that scans
23 ** the entire corpus. Or it can use the FTS4 or FTS5 search engine of
24 ** SQLite. The choice is a administrator configuration option.
25 **
@@ -331,10 +332,18 @@
332 **
333 ** Usage: %fossil test-match SEARCHSTRING FILE1 FILE2 ...
334 **
335 ** Run the full-scan search algorithm using SEARCHSTRING against
336 ** the text of the files listed. Output matches and snippets.
337 **
338 ** Options:
339 **
340 ** --begin TEXT Text to insert before each match
341 ** --end TEXT Text to insert after each match
342 ** --gap TEXT Text to indicate elided content
343 ** --html Input is HTML
344 ** --static Use the static Search object
345 */
346 void test_match_cmd(void){
347 Search *p;
348 int i;
349 Blob x;
@@ -372,11 +381,12 @@
381 **
382 ** All arguments are optional. PATTERN is the search pattern. If it
383 ** is omitted, then the global search pattern is reset. BEGIN and END
384 ** and GAP are the strings used to construct snippets. FLAGS is an
385 ** integer bit pattern containing the various SRCH_CKIN, SRCH_DOC,
386 ** SRCH_TKT, SRCH_FORUM, or SRCH_ALL bits to determine what is to be
387 ** searched.
388 */
389 static void search_init_sqlfunc(
390 sqlite3_context *context,
391 int argc,
392 sqlite3_value **argv
@@ -407,11 +417,11 @@
417
418 /* search_match(TEXT, TEXT, ....)
419 **
420 ** Using the full-scan search engine created by the most recent call
421 ** to search_init(), match the input the TEXT arguments.
422 ** Remember the results in the global full-scan search object.
423 ** Return non-zero on a match and zero on a miss.
424 */
425 static void search_match_sqlfunc(
426 sqlite3_context *context,
427 int argc,
@@ -560,10 +570,15 @@
570 ** Usage: %fossil search [-all|-a] [-limit|-n #] [-width|-W #] pattern...
571 **
572 ** Search for timeline entries matching all words provided on the
573 ** command line. Whole-word matches scope more highly than partial
574 ** matches.
575 **
576 ** Note: The command only search the EVENT table. So it will only
577 ** display check-in comments or other comments that appear on an
578 ** unaugmented timeline. It does not search document text or forum
579 ** messages.
580 **
581 ** Outputs, by default, some top-N fraction of the results. The -all
582 ** option can be used to output all matches, regardless of their search
583 ** score. The -limit option can be used to limit the number of entries
584 ** returned. The -width option can be used to set the output width used
@@ -645,11 +660,12 @@
660 #define SRCH_ALL 0x003f /* Search over everything */
661 #endif
662
663 /*
664 ** Remove bits from srchFlags which are disallowed by either the
665 ** current server configuration or by user permissions. Return
666 ** the revised search flags mask.
667 */
668 unsigned int search_restrict(unsigned int srchFlags){
669 static unsigned int knownGood = 0;
670 static unsigned int knownBad = 0;
671 static const struct { unsigned m; const char *zKey; } aSetng[] = {
672

Keyboard Shortcuts

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