Fossil SCM

More use of row-values in the search mechanism.

drh 2016-09-22 21:14 trunk
Commit bc21e0a4c85a30d9cb6a4618b2f7d636807888eb
1 file changed +27 -27
+27 -27
--- src/search.c
+++ src/search.c
@@ -1590,20 +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
- "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"
1595
+ "UPDATE ftsdocs SET idxed=1, name=NULL,"
1596
+ " (label,url,mtime) = "
1597
+ " (SELECT printf('Check-in [%%.16s] on %%s',blob.uuid,"
1598
+ " 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"
16051605
);
16061606
}
16071607
16081608
/*
16091609
** Deal with all of the unindexed 't' terms in FTSDOCS
@@ -1614,19 +1614,19 @@
16141614
" SELECT rowid, title('t',rid,NULL), body('t',rid,NULL) FROM ftsdocs"
16151615
" WHERE type='t' AND NOT idxed;"
16161616
);
16171617
if( db_changes()==0 ) return;
16181618
db_multi_exec(
1619
- "REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)"
1620
- " SELECT ftsdocs.rowid, 1, 't', ftsdocs.rid, NULL,"
1621
- " printf('Ticket: %%s (%%s)',title('t',tkt_id,null),"
1622
- " datetime(tkt_mtime)),"
1623
- " printf('/tktview/%%.20s',tkt_uuid),"
1624
- " tkt_mtime"
1625
- " FROM ftsdocs, ticket"
1626
- " WHERE ftsdocs.type='t' AND NOT ftsdocs.idxed"
1627
- " AND ticket.tkt_id=ftsdocs.rid"
1619
+ "UPDATE ftsdocs SET idxed=1, name=NULL,"
1620
+ " (label,url,mtime) ="
1621
+ " (SELECT printf('Ticket: %%s (%%s)',title('t',tkt_id,null),"
1622
+ " datetime(tkt_mtime)),"
1623
+ " printf('/tktview/%%.20s',tkt_uuid),"
1624
+ " tkt_mtime"
1625
+ " FROM ticket"
1626
+ " WHERE tkt_id=ftsdocs.rid)"
1627
+ "WHERE ftsdocs.type='t' AND NOT ftsdocs.idxed"
16281628
);
16291629
}
16301630
16311631
/*
16321632
** Deal with all of the unindexed 'w' terms in FTSDOCS
@@ -1637,18 +1637,18 @@
16371637
" SELECT rowid, title('w',rid,NULL),body('w',rid,NULL) FROM ftsdocs"
16381638
" WHERE type='w' AND NOT idxed;"
16391639
);
16401640
if( db_changes()==0 ) return;
16411641
db_multi_exec(
1642
- "REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)"
1643
- " SELECT ftsdocs.rowid, 1, 'w', ftsdocs.rid, ftsdocs.name,"
1644
- " 'Wiki: '||ftsdocs.name,"
1645
- " '/wiki?name='||urlencode(ftsdocs.name),"
1646
- " tagxref.mtime"
1647
- " FROM ftsdocs, tagxref"
1648
- " WHERE ftsdocs.type='w' AND NOT ftsdocs.idxed"
1649
- " AND tagxref.rid=ftsdocs.rid"
1642
+ "UPDATE ftsdocs SET idxed=1,"
1643
+ " (name,label,url,mtime) = "
1644
+ " (SELECT ftsdocs.name,"
1645
+ " 'Wiki: '||ftsdocs.name,"
1646
+ " '/wiki?name='||urlencode(ftsdocs.name),"
1647
+ " tagxref.mtime"
1648
+ " FROM tagxref WHERE tagxref.rid=ftsdocs.rid)"
1649
+ " WHERE ftsdocs.type='w' AND NOT ftsdocs.idxed"
16501650
);
16511651
}
16521652
16531653
/*
16541654
** Deal with all of the unindexed entries in the FTSDOCS table - that
16551655
--- src/search.c
+++ src/search.c
@@ -1590,20 +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
@@ -1614,19 +1614,19 @@
1614 " SELECT rowid, title('t',rid,NULL), body('t',rid,NULL) FROM ftsdocs"
1615 " WHERE type='t' AND NOT idxed;"
1616 );
1617 if( db_changes()==0 ) return;
1618 db_multi_exec(
1619 "REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)"
1620 " SELECT ftsdocs.rowid, 1, 't', ftsdocs.rid, NULL,"
1621 " printf('Ticket: %%s (%%s)',title('t',tkt_id,null),"
1622 " datetime(tkt_mtime)),"
1623 " printf('/tktview/%%.20s',tkt_uuid),"
1624 " tkt_mtime"
1625 " FROM ftsdocs, ticket"
1626 " WHERE ftsdocs.type='t' AND NOT ftsdocs.idxed"
1627 " AND ticket.tkt_id=ftsdocs.rid"
1628 );
1629 }
1630
1631 /*
1632 ** Deal with all of the unindexed 'w' terms in FTSDOCS
@@ -1637,18 +1637,18 @@
1637 " SELECT rowid, title('w',rid,NULL),body('w',rid,NULL) FROM ftsdocs"
1638 " WHERE type='w' AND NOT idxed;"
1639 );
1640 if( db_changes()==0 ) return;
1641 db_multi_exec(
1642 "REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)"
1643 " SELECT ftsdocs.rowid, 1, 'w', ftsdocs.rid, ftsdocs.name,"
1644 " 'Wiki: '||ftsdocs.name,"
1645 " '/wiki?name='||urlencode(ftsdocs.name),"
1646 " tagxref.mtime"
1647 " FROM ftsdocs, tagxref"
1648 " WHERE ftsdocs.type='w' AND NOT ftsdocs.idxed"
1649 " AND tagxref.rid=ftsdocs.rid"
1650 );
1651 }
1652
1653 /*
1654 ** Deal with all of the unindexed entries in the FTSDOCS table - that
1655
--- src/search.c
+++ src/search.c
@@ -1590,20 +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 SET idxed=1, name=NULL,"
1596 " (label,url,mtime) = "
1597 " (SELECT printf('Check-in [%%.16s] on %%s',blob.uuid,"
1598 " 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
@@ -1614,19 +1614,19 @@
1614 " SELECT rowid, title('t',rid,NULL), body('t',rid,NULL) FROM ftsdocs"
1615 " WHERE type='t' AND NOT idxed;"
1616 );
1617 if( db_changes()==0 ) return;
1618 db_multi_exec(
1619 "UPDATE ftsdocs SET idxed=1, name=NULL,"
1620 " (label,url,mtime) ="
1621 " (SELECT printf('Ticket: %%s (%%s)',title('t',tkt_id,null),"
1622 " datetime(tkt_mtime)),"
1623 " printf('/tktview/%%.20s',tkt_uuid),"
1624 " tkt_mtime"
1625 " FROM ticket"
1626 " WHERE tkt_id=ftsdocs.rid)"
1627 "WHERE ftsdocs.type='t' AND NOT ftsdocs.idxed"
1628 );
1629 }
1630
1631 /*
1632 ** Deal with all of the unindexed 'w' terms in FTSDOCS
@@ -1637,18 +1637,18 @@
1637 " SELECT rowid, title('w',rid,NULL),body('w',rid,NULL) FROM ftsdocs"
1638 " WHERE type='w' AND NOT idxed;"
1639 );
1640 if( db_changes()==0 ) return;
1641 db_multi_exec(
1642 "UPDATE ftsdocs SET idxed=1,"
1643 " (name,label,url,mtime) = "
1644 " (SELECT ftsdocs.name,"
1645 " 'Wiki: '||ftsdocs.name,"
1646 " '/wiki?name='||urlencode(ftsdocs.name),"
1647 " tagxref.mtime"
1648 " FROM tagxref WHERE tagxref.rid=ftsdocs.rid)"
1649 " WHERE ftsdocs.type='w' AND NOT ftsdocs.idxed"
1650 );
1651 }
1652
1653 /*
1654 ** Deal with all of the unindexed entries in the FTSDOCS table - that
1655

Keyboard Shortcuts

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