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.

drh 2016-09-22 20:55 trunk
Commit b1b4eaa5644e7e20994f1aff383cb29fa2e5d4c9
2 files changed +1 -1 +10 -6
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -357,11 +357,11 @@
357357
struct Blob *content,
358358
void *opaque
359359
){
360360
char *zLink = blob_buffer(link);
361361
BLOB_APPEND_LITERAL(ob, "<a href=\"");
362
- if( zLink && zLink[0]=='/' ){
362
+ if( zLink && zLink[0]=='/' && g.zTop ){
363363
/* For any hyperlink that begins with "/", make it refer to the root
364364
** of the Fossil repository */
365365
blob_append(ob, g.zTop, -1);
366366
}
367367
html_escape(ob, blob_buffer(link), blob_size(link));
368368
--- 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 @@
15901590
"INSERT INTO ftsidx(docid,title,body)"
15911591
" SELECT rowid, '', body('c',rid,NULL) FROM ftsdocs"
15921592
" WHERE type='c' AND NOT idxed;"
15931593
);
15941594
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,"
15971598
" printf('Check-in [%%.16s] on %%s',blob.uuid,datetime(event.mtime)),"
15981599
" printf('/timeline?y=ci&c=%%.20s',blob.uuid),"
15991600
" event.mtime"
1600
- " FROM ftsdocs, event, blob"
1601
+ " FROM event, blob"
1602
+ " WHERE event.objid=ftsdocs.rid"
1603
+ " AND blob.rid=ftsdocs.rid)"
16011604
" WHERE ftsdocs.type='c' AND NOT ftsdocs.idxed"
1602
- " AND event.objid=ftsdocs.rid"
1603
- " AND blob.rid=ftsdocs.rid"
16041605
);
16051606
}
16061607
16071608
/*
16081609
** Deal with all of the unindexed 't' terms in FTSDOCS
@@ -1704,11 +1705,11 @@
17041705
** search. (Unindexed search is never stemmed.)
17051706
**
17061707
** The current search settings are displayed after any changes are applied.
17071708
** Run this command with no arguments to simply see the settings.
17081709
*/
1709
-void test_fts_cmd(void){
1710
+void fts_config_cmd(void){
17101711
static const struct { int iCmd; const char *z; } aCmd[] = {
17111712
{ 1, "reindex" },
17121713
{ 2, "index" },
17131714
{ 3, "disable" },
17141715
{ 4, "enable" },
@@ -1739,10 +1740,13 @@
17391740
zSubCmd, blob_str(&all));
17401741
return;
17411742
}
17421743
iCmd = aCmd[i].iCmd;
17431744
}
1745
+ g.perm.Read = 1;
1746
+ g.perm.RdTkt = 1;
1747
+ g.perm.RdWiki = 1;
17441748
if( iCmd==1 ){
17451749
if( search_index_exists() ) iAction = 2;
17461750
}
17471751
if( iCmd==2 ){
17481752
if( g.argc<3 ) usage("index (on|off)");
17491753
--- 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

Keyboard Shortcuts

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