Fossil SCM
Minor comment fixes in the search logic. No changes to code.
Commit
4d351608666ae138087bfb4c61720000eaaa9b41edead85a332941f084104368
Parent
ce6eaf0fb0444a9…
1 file changed
+20
-4
+20
-4
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -14,11 +14,12 @@ | ||
| 14 | 14 | ** http://www.hwaci.com/drh/ |
| 15 | 15 | ** |
| 16 | 16 | ******************************************************************************* |
| 17 | 17 | ** |
| 18 | 18 | ** 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. | |
| 20 | 21 | ** |
| 21 | 22 | ** The search can be either a per-query "grep"-like search that scans |
| 22 | 23 | ** the entire corpus. Or it can use the FTS4 or FTS5 search engine of |
| 23 | 24 | ** SQLite. The choice is a administrator configuration option. |
| 24 | 25 | ** |
| @@ -331,10 +332,18 @@ | ||
| 331 | 332 | ** |
| 332 | 333 | ** Usage: %fossil test-match SEARCHSTRING FILE1 FILE2 ... |
| 333 | 334 | ** |
| 334 | 335 | ** Run the full-scan search algorithm using SEARCHSTRING against |
| 335 | 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 | |
| 336 | 345 | */ |
| 337 | 346 | void test_match_cmd(void){ |
| 338 | 347 | Search *p; |
| 339 | 348 | int i; |
| 340 | 349 | Blob x; |
| @@ -372,11 +381,12 @@ | ||
| 372 | 381 | ** |
| 373 | 382 | ** All arguments are optional. PATTERN is the search pattern. If it |
| 374 | 383 | ** is omitted, then the global search pattern is reset. BEGIN and END |
| 375 | 384 | ** and GAP are the strings used to construct snippets. FLAGS is an |
| 376 | 385 | ** 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. | |
| 378 | 388 | */ |
| 379 | 389 | static void search_init_sqlfunc( |
| 380 | 390 | sqlite3_context *context, |
| 381 | 391 | int argc, |
| 382 | 392 | sqlite3_value **argv |
| @@ -407,11 +417,11 @@ | ||
| 407 | 417 | |
| 408 | 418 | /* search_match(TEXT, TEXT, ....) |
| 409 | 419 | ** |
| 410 | 420 | ** Using the full-scan search engine created by the most recent call |
| 411 | 421 | ** 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. | |
| 413 | 423 | ** Return non-zero on a match and zero on a miss. |
| 414 | 424 | */ |
| 415 | 425 | static void search_match_sqlfunc( |
| 416 | 426 | sqlite3_context *context, |
| 417 | 427 | int argc, |
| @@ -560,10 +570,15 @@ | ||
| 560 | 570 | ** Usage: %fossil search [-all|-a] [-limit|-n #] [-width|-W #] pattern... |
| 561 | 571 | ** |
| 562 | 572 | ** Search for timeline entries matching all words provided on the |
| 563 | 573 | ** command line. Whole-word matches scope more highly than partial |
| 564 | 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. | |
| 565 | 580 | ** |
| 566 | 581 | ** Outputs, by default, some top-N fraction of the results. The -all |
| 567 | 582 | ** option can be used to output all matches, regardless of their search |
| 568 | 583 | ** score. The -limit option can be used to limit the number of entries |
| 569 | 584 | ** returned. The -width option can be used to set the output width used |
| @@ -645,11 +660,12 @@ | ||
| 645 | 660 | #define SRCH_ALL 0x003f /* Search over everything */ |
| 646 | 661 | #endif |
| 647 | 662 | |
| 648 | 663 | /* |
| 649 | 664 | ** 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. | |
| 651 | 667 | */ |
| 652 | 668 | unsigned int search_restrict(unsigned int srchFlags){ |
| 653 | 669 | static unsigned int knownGood = 0; |
| 654 | 670 | static unsigned int knownBad = 0; |
| 655 | 671 | static const struct { unsigned m; const char *zKey; } aSetng[] = { |
| 656 | 672 |
| --- 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 |