Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add support for multiple branch names in the doc-branch setting, as discussed in forum post 520d420d04. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
40d0b360d2cf9d72b4430836a6ddef5a |
User & Date: | stephan 2024-10-23 18:21:36 |
Context
2024-10-25
| ||
05:38 | Upstream fix to autosetup/autosetup-find-tcl to work around an OpenBSD-ism of emitting noise to stdout at link-time. ... (check-in: ddfc5c42 user: stephan tags: trunk) | |
2024-10-23
| ||
18:21 | Add support for multiple branch names in the doc-branch setting, as discussed in forum post 520d420d04. ... (check-in: 40d0b360 user: stephan tags: trunk) | |
12:02 | Merge typo fixes by brickviking into trunk. ... (check-in: af1456ba user: drh tags: trunk) | |
2024-10-22
| ||
23:42 | Extend [b82749b94bd1db3f] to include the fts reindexing step. ... (Closed-Leaf check-in: 3d76303a user: stephan tags: doc-branch-multi) | |
Changes
Changes to src/search.c.
︙ | ︙ | |||
792 793 794 795 796 797 798 799 800 801 | ){ search_init(zPattern, "<mark>", "</mark>", " ... ", SRCHFLG_STATIC|SRCHFLG_HTML); if( (srchFlags & SRCH_DOC)!=0 ){ char *zDocGlob = db_get("doc-glob",""); char *zDocBr = db_get("doc-branch","trunk"); if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){ db_multi_exec( "CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;" ); | > > > > > > | | | | | | | | | | | | | | | | | > > | 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | ){ search_init(zPattern, "<mark>", "</mark>", " ... ", SRCHFLG_STATIC|SRCHFLG_HTML); if( (srchFlags & SRCH_DOC)!=0 ){ char *zDocGlob = db_get("doc-glob",""); char *zDocBr = db_get("doc-branch","trunk"); if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){ Glob * pGlob = glob_create(zDocBr) /* We're misusing a Glob as a list of comma-/space-delimited ** tokens. We're not actually doing glob matches here. */; int i; db_multi_exec( "CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;" ); for( i = 0; i < pGlob->nPattern; ++i ){ const char * zBranch = pGlob->azPattern[i]; db_multi_exec( "INSERT INTO x(label,url,score,id,date,snip)" " SELECT printf('Document: %%s',title('d',blob.rid,foci.filename))," " printf('/doc/%T/%%s',foci.filename)," " search_score()," " 'd'||blob.rid," " (SELECT datetime(event.mtime) FROM event" " WHERE objid=symbolic_name_to_rid(%Q))," " search_snippet()" " FROM foci CROSS JOIN blob" " WHERE checkinID=symbolic_name_to_rid(%Q)" " AND blob.uuid=foci.uuid" " AND search_match(title('d',blob.rid,foci.filename)," " body('d',blob.rid,foci.filename))" " AND %z", zBranch, zBranch, zBranch, glob_expr("foci.filename", zDocGlob) ); } glob_free(pGlob); } fossil_free(zDocGlob); fossil_free(zDocBr); } if( (srchFlags & SRCH_WIKI)!=0 ){ db_multi_exec( "WITH wiki(name,rid,mtime) AS (" |
︙ | ︙ | |||
1878 1879 1880 1881 1882 1883 1884 | /* ** If the doc-glob and doc-br settings are valid for document search ** and if the latest check-in on doc-br is in the unindexed set of ** check-ins, then update all 'd' entries in FTSDOCS that have ** changed. */ static void search_update_doc_index(void){ | | | | | < < | < | < > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 | /* ** If the doc-glob and doc-br settings are valid for document search ** and if the latest check-in on doc-br is in the unindexed set of ** check-ins, then update all 'd' entries in FTSDOCS that have ** changed. */ static void search_update_doc_index(void){ const char *zDocBranches = db_get("doc-branch","trunk"); int i; Glob * pGlob = glob_create(zDocBranches) /* We're misusing a Glob as a list of comma-/space-delimited ** tokens. We're not actually doing glob matches here. */; if( !pGlob ) return; db_multi_exec( "CREATE TEMP TABLE current_docs(rid INTEGER PRIMARY KEY, name);" "CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;" ); for( i = 0; i < pGlob->nPattern; ++i ){ const char *zDocBr = pGlob->azPattern[i]; int ckid = symbolic_name_to_rid(zDocBr,"ci"); double rTime; if( !db_exists("SELECT 1 FROM ftsdocs WHERE type='c' AND rid=%d" " AND NOT idxed", ckid) ) continue; /* If we get this far, it means that changes to 'd' entries are ** required. */ rTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", ckid); db_multi_exec( "INSERT OR IGNORE INTO current_docs(rid, name)" " SELECT blob.rid, foci.filename FROM foci, blob" " WHERE foci.checkinID=%d AND blob.uuid=foci.uuid" " AND %z", ckid, glob_expr("foci.filename", db_get("doc-glob","")) ); db_multi_exec( "DELETE FROM ftsidx WHERE rowid IN" " (SELECT rowid FROM ftsdocs WHERE type='d'" " AND rid NOT IN (SELECT rid FROM current_docs))" ); db_multi_exec( "DELETE FROM ftsdocs WHERE type='d'" " AND rid NOT IN (SELECT rid FROM current_docs)" ); db_multi_exec( "INSERT OR IGNORE INTO ftsdocs(type,rid,name,idxed,label,bx,url,mtime)" " SELECT 'd', rid, name, 0," " title('d',rid,name)," " body('d',rid,name)," " printf('/doc/%T/%%s',urlencode(name))," " %.17g" " FROM current_docs", zDocBr, rTime ); db_multi_exec( "INSERT INTO ftsidx(rowid,title,body)" " SELECT rowid, label, bx FROM ftsdocs WHERE type='d' AND NOT idxed" ); db_multi_exec( "UPDATE ftsdocs SET" " idxed=1," " bx=NULL," " label='Document: '||label" " WHERE type='d' AND NOT idxed" ); } glob_free(pGlob); } /* ** Deal with all of the unindexed 'c' terms in FTSDOCS */ static void search_update_checkin_index(void){ db_multi_exec( |
︙ | ︙ |
Changes to src/setup.c.
︙ | ︙ | |||
2185 2186 2187 2188 2189 2190 2191 | @ <td>Search all Markdown files in the doc/ subfolder and all README.txt @ files.</tr> @ <tr><td>*<td><td>Search all checked-in files</tr> @ <tr><td><i>(blank)</i><td> @ <td>Search nothing. (Disables document search).</tr> @ </table> @ <hr> | | | | > | 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 | @ <td>Search all Markdown files in the doc/ subfolder and all README.txt @ files.</tr> @ <tr><td>*<td><td>Search all checked-in files</tr> @ <tr><td><i>(blank)</i><td> @ <td>Search nothing. (Disables document search).</tr> @ </table> @ <hr> entry_attribute("Document Branches", 20, "doc-branch", "db", "trunk", 0); @ <p>When searching documents, use the versions of the files found at the @ type of the "Document Branches" branch. Recommended value: "trunk". @ Document search is disabled if blank. It may be a list of branch names @ separated by spaces and/or commas. @ <hr> onoff_attribute("Search Check-in Comments", "search-ci", "sc", 0, 0); @ <br> onoff_attribute("Search Documents", "search-doc", "sd", 0, 0); @ <br> onoff_attribute("Search Tickets", "search-tkt", "st", 0, 0); @ <br> |
︙ | ︙ |