Fossil SCM
Fix the "fossil fts-config reindex" command so that it really does reindex everything. Fix the markdown HTML formatter so that it can be run from the command-line. Change a query in the search engine to use a row-value update, in order to beta-test the new row-value update mechanism of SQLite.
Commit
b1b4eaa5644e7e20994f1aff383cb29fa2e5d4c9
Parent
60426fbcdd3bf06…
2 files changed
+1
-1
+10
-6
+1
-1
| --- src/markdown_html.c | ||
| +++ src/markdown_html.c | ||
| @@ -357,11 +357,11 @@ | ||
| 357 | 357 | struct Blob *content, |
| 358 | 358 | void *opaque |
| 359 | 359 | ){ |
| 360 | 360 | char *zLink = blob_buffer(link); |
| 361 | 361 | BLOB_APPEND_LITERAL(ob, "<a href=\""); |
| 362 | - if( zLink && zLink[0]=='/' ){ | |
| 362 | + if( zLink && zLink[0]=='/' && g.zTop ){ | |
| 363 | 363 | /* For any hyperlink that begins with "/", make it refer to the root |
| 364 | 364 | ** of the Fossil repository */ |
| 365 | 365 | blob_append(ob, g.zTop, -1); |
| 366 | 366 | } |
| 367 | 367 | html_escape(ob, blob_buffer(link), blob_size(link)); |
| 368 | 368 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -357,11 +357,11 @@ | |
| 357 | struct Blob *content, |
| 358 | void *opaque |
| 359 | ){ |
| 360 | char *zLink = blob_buffer(link); |
| 361 | BLOB_APPEND_LITERAL(ob, "<a href=\""); |
| 362 | if( zLink && zLink[0]=='/' ){ |
| 363 | /* For any hyperlink that begins with "/", make it refer to the root |
| 364 | ** of the Fossil repository */ |
| 365 | blob_append(ob, g.zTop, -1); |
| 366 | } |
| 367 | html_escape(ob, blob_buffer(link), blob_size(link)); |
| 368 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -357,11 +357,11 @@ | |
| 357 | struct Blob *content, |
| 358 | void *opaque |
| 359 | ){ |
| 360 | char *zLink = blob_buffer(link); |
| 361 | BLOB_APPEND_LITERAL(ob, "<a href=\""); |
| 362 | if( zLink && zLink[0]=='/' && g.zTop ){ |
| 363 | /* For any hyperlink that begins with "/", make it refer to the root |
| 364 | ** of the Fossil repository */ |
| 365 | blob_append(ob, g.zTop, -1); |
| 366 | } |
| 367 | html_escape(ob, blob_buffer(link), blob_size(link)); |
| 368 |
+10
-6
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -1590,19 +1590,20 @@ | ||
| 1590 | 1590 | "INSERT INTO ftsidx(docid,title,body)" |
| 1591 | 1591 | " SELECT rowid, '', body('c',rid,NULL) FROM ftsdocs" |
| 1592 | 1592 | " WHERE type='c' AND NOT idxed;" |
| 1593 | 1593 | ); |
| 1594 | 1594 | db_multi_exec( |
| 1595 | - "REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)" | |
| 1596 | - " SELECT ftsdocs.rowid, 1, 'c', ftsdocs.rid, NULL," | |
| 1595 | + "UPDATE ftsdocs" | |
| 1596 | + " SET (idxed,name,label,url,mtime) = " | |
| 1597 | + " (SELECT 1, NULL," | |
| 1597 | 1598 | " printf('Check-in [%%.16s] on %%s',blob.uuid,datetime(event.mtime))," |
| 1598 | 1599 | " printf('/timeline?y=ci&c=%%.20s',blob.uuid)," |
| 1599 | 1600 | " event.mtime" |
| 1600 | - " FROM ftsdocs, event, blob" | |
| 1601 | + " FROM event, blob" | |
| 1602 | + " WHERE event.objid=ftsdocs.rid" | |
| 1603 | + " AND blob.rid=ftsdocs.rid)" | |
| 1601 | 1604 | " WHERE ftsdocs.type='c' AND NOT ftsdocs.idxed" |
| 1602 | - " AND event.objid=ftsdocs.rid" | |
| 1603 | - " AND blob.rid=ftsdocs.rid" | |
| 1604 | 1605 | ); |
| 1605 | 1606 | } |
| 1606 | 1607 | |
| 1607 | 1608 | /* |
| 1608 | 1609 | ** Deal with all of the unindexed 't' terms in FTSDOCS |
| @@ -1704,11 +1705,11 @@ | ||
| 1704 | 1705 | ** search. (Unindexed search is never stemmed.) |
| 1705 | 1706 | ** |
| 1706 | 1707 | ** The current search settings are displayed after any changes are applied. |
| 1707 | 1708 | ** Run this command with no arguments to simply see the settings. |
| 1708 | 1709 | */ |
| 1709 | -void test_fts_cmd(void){ | |
| 1710 | +void fts_config_cmd(void){ | |
| 1710 | 1711 | static const struct { int iCmd; const char *z; } aCmd[] = { |
| 1711 | 1712 | { 1, "reindex" }, |
| 1712 | 1713 | { 2, "index" }, |
| 1713 | 1714 | { 3, "disable" }, |
| 1714 | 1715 | { 4, "enable" }, |
| @@ -1739,10 +1740,13 @@ | ||
| 1739 | 1740 | zSubCmd, blob_str(&all)); |
| 1740 | 1741 | return; |
| 1741 | 1742 | } |
| 1742 | 1743 | iCmd = aCmd[i].iCmd; |
| 1743 | 1744 | } |
| 1745 | + g.perm.Read = 1; | |
| 1746 | + g.perm.RdTkt = 1; | |
| 1747 | + g.perm.RdWiki = 1; | |
| 1744 | 1748 | if( iCmd==1 ){ |
| 1745 | 1749 | if( search_index_exists() ) iAction = 2; |
| 1746 | 1750 | } |
| 1747 | 1751 | if( iCmd==2 ){ |
| 1748 | 1752 | if( g.argc<3 ) usage("index (on|off)"); |
| 1749 | 1753 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -1590,19 +1590,20 @@ | |
| 1590 | "INSERT INTO ftsidx(docid,title,body)" |
| 1591 | " SELECT rowid, '', body('c',rid,NULL) FROM ftsdocs" |
| 1592 | " WHERE type='c' AND NOT idxed;" |
| 1593 | ); |
| 1594 | db_multi_exec( |
| 1595 | "REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)" |
| 1596 | " SELECT ftsdocs.rowid, 1, 'c', ftsdocs.rid, NULL," |
| 1597 | " printf('Check-in [%%.16s] on %%s',blob.uuid,datetime(event.mtime))," |
| 1598 | " printf('/timeline?y=ci&c=%%.20s',blob.uuid)," |
| 1599 | " event.mtime" |
| 1600 | " FROM ftsdocs, event, blob" |
| 1601 | " WHERE ftsdocs.type='c' AND NOT ftsdocs.idxed" |
| 1602 | " AND event.objid=ftsdocs.rid" |
| 1603 | " AND blob.rid=ftsdocs.rid" |
| 1604 | ); |
| 1605 | } |
| 1606 | |
| 1607 | /* |
| 1608 | ** Deal with all of the unindexed 't' terms in FTSDOCS |
| @@ -1704,11 +1705,11 @@ | |
| 1704 | ** search. (Unindexed search is never stemmed.) |
| 1705 | ** |
| 1706 | ** The current search settings are displayed after any changes are applied. |
| 1707 | ** Run this command with no arguments to simply see the settings. |
| 1708 | */ |
| 1709 | void test_fts_cmd(void){ |
| 1710 | static const struct { int iCmd; const char *z; } aCmd[] = { |
| 1711 | { 1, "reindex" }, |
| 1712 | { 2, "index" }, |
| 1713 | { 3, "disable" }, |
| 1714 | { 4, "enable" }, |
| @@ -1739,10 +1740,13 @@ | |
| 1739 | zSubCmd, blob_str(&all)); |
| 1740 | return; |
| 1741 | } |
| 1742 | iCmd = aCmd[i].iCmd; |
| 1743 | } |
| 1744 | if( iCmd==1 ){ |
| 1745 | if( search_index_exists() ) iAction = 2; |
| 1746 | } |
| 1747 | if( iCmd==2 ){ |
| 1748 | if( g.argc<3 ) usage("index (on|off)"); |
| 1749 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -1590,19 +1590,20 @@ | |
| 1590 | "INSERT INTO ftsidx(docid,title,body)" |
| 1591 | " SELECT rowid, '', body('c',rid,NULL) FROM ftsdocs" |
| 1592 | " WHERE type='c' AND NOT idxed;" |
| 1593 | ); |
| 1594 | db_multi_exec( |
| 1595 | "UPDATE ftsdocs" |
| 1596 | " SET (idxed,name,label,url,mtime) = " |
| 1597 | " (SELECT 1, NULL," |
| 1598 | " printf('Check-in [%%.16s] on %%s',blob.uuid,datetime(event.mtime))," |
| 1599 | " printf('/timeline?y=ci&c=%%.20s',blob.uuid)," |
| 1600 | " event.mtime" |
| 1601 | " FROM event, blob" |
| 1602 | " WHERE event.objid=ftsdocs.rid" |
| 1603 | " AND blob.rid=ftsdocs.rid)" |
| 1604 | " WHERE ftsdocs.type='c' AND NOT ftsdocs.idxed" |
| 1605 | ); |
| 1606 | } |
| 1607 | |
| 1608 | /* |
| 1609 | ** Deal with all of the unindexed 't' terms in FTSDOCS |
| @@ -1704,11 +1705,11 @@ | |
| 1705 | ** search. (Unindexed search is never stemmed.) |
| 1706 | ** |
| 1707 | ** The current search settings are displayed after any changes are applied. |
| 1708 | ** Run this command with no arguments to simply see the settings. |
| 1709 | */ |
| 1710 | void fts_config_cmd(void){ |
| 1711 | static const struct { int iCmd; const char *z; } aCmd[] = { |
| 1712 | { 1, "reindex" }, |
| 1713 | { 2, "index" }, |
| 1714 | { 3, "disable" }, |
| 1715 | { 4, "enable" }, |
| @@ -1739,10 +1740,13 @@ | |
| 1740 | zSubCmd, blob_str(&all)); |
| 1741 | return; |
| 1742 | } |
| 1743 | iCmd = aCmd[i].iCmd; |
| 1744 | } |
| 1745 | g.perm.Read = 1; |
| 1746 | g.perm.RdTkt = 1; |
| 1747 | g.perm.RdWiki = 1; |
| 1748 | if( iCmd==1 ){ |
| 1749 | if( search_index_exists() ) iAction = 2; |
| 1750 | } |
| 1751 | if( iCmd==2 ){ |
| 1752 | if( g.argc<3 ) usage("index (on|off)"); |
| 1753 |