Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix more minor search problems. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | experimental |
Files: | files | file ages | folders |
SHA1: |
c3458599282eb25300793904045b7399 |
User & Date: | dan 2016-08-19 17:02:50.714 |
Context
2016-08-20
| ||
17:22 | Add "jump to" links to relevant sections of large documents in search results. (check-in: 9d49a78f9b user: dan tags: experimental) | |
2016-08-19
| ||
17:02 | Fix more minor search problems. (check-in: c345859928 user: dan tags: experimental) | |
2016-08-18
| ||
20:07 | Rework the site search to use FTS5. (check-in: 18e4a7b157 user: dan tags: experimental) | |
Changes
Changes to document_header.tcl.
︙ | ︙ | |||
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | } else { set tagline {Small. Fast. Reliable.<br>Choose any three.} } append ret [subst -nocommands {<body> <div><!-- container div to satisfy validator --> <a href="${path}index.html"> <img class="logo" src="${path}images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">${tagline}</div> <table width=100% class="menubar"><tr> | > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | } else { set tagline {Small. Fast. Reliable.<br>Choose any three.} } append ret [subst -nocommands {<body> <div><!-- container div to satisfy validator --> <div class=nosearch> <a href="${path}index.html"> <img class="logo" src="${path}images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">${tagline}</div> <table width=100% class="menubar"><tr> |
︙ | ︙ | |||
184 185 186 187 188 189 190 191 192 193 194 | <form name=f method="GET" action="/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; $initstyle;" value="$initval"> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> }] return $ret } | > | 185 186 187 188 189 190 191 192 193 194 195 196 | <form name=f method="GET" action="/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; $initstyle;" value="$initval"> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> </div> <!-- matches "div class=nosearch" --> }] return $ret } |
Changes to main.mk.
︙ | ︙ | |||
143 144 145 146 147 148 149 | # Build the fts3 database used by the search script # parsehtml.so: $(DOC)/search/parsehtml.c gcc -g -shared -fPIC $(TCLINC) -I. -I$(SRC)/ext/fts3 $(DOC)/search/parsehtml.c $(TCLSTUBFLAGS) -o parsehtml.so searchdb: parsehtml.so tclsh ./tclsh $(DOC)/search/buildsearchdb.tcl | < > | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | # Build the fts3 database used by the search script # parsehtml.so: $(DOC)/search/parsehtml.c gcc -g -shared -fPIC $(TCLINC) -I. -I$(SRC)/ext/fts3 $(DOC)/search/parsehtml.c $(TCLSTUBFLAGS) -o parsehtml.so searchdb: parsehtml.so tclsh ./tclsh $(DOC)/search/buildsearchdb.tcl cp $(DOC)/document_header.tcl doc/document_header.tcl cp $(DOC)/search/search.tcl doc/search chmod +x doc/search always: clean: rm -rf tclsh doc sqlite3.h |
Changes to pages/fancyformat.tcl.
︙ | ︙ | |||
423 424 425 426 427 428 429 | # this text. The "<div class=startsearch>" tag tells the script that # builds the site-search database not to index any text that occurs # before it. This stops the table of contents from being used for # snippets on search results pages. # set toc [subst { <div class=fancy> | > > | | | | | > | | | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | # this text. The "<div class=startsearch>" tag tells the script that # builds the site-search database not to index any text that occurs # before it. This stops the table of contents from being used for # snippets on search results pages. # set toc [subst { <div class=fancy> <div class=nosearch> <div style="font-size:2em;text-align:center;color:#044a64"> $::Addtoc(title) </div> <div style="font-size:1.5em;margin:1em;color:#044a64"> Table Of Contents </div> <div id=toc> $::Addtoc(toc) </div> </div> }] set fancy [subst { <div class=fancy> <div style="font-size:2em;text-align:center;color:#044a64"> $::Addtoc(title) </div> <div class=startsearch></div> |
︙ | ︙ |
Changes to search/buildsearchdb.tcl.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | } generic { set nosearch(doc_keyword_crossref.html) 1 set nosearch(doc_backlink_crossref.html) 1 set nosearch(doc_pagelink_crossref.html) 1 set nosearch(doc_target_crossref.html) 1 set nosearch(keyword_index.html) 1 set nosearch(requirements.html) 1 set nosearch(sitemap.html) 1 set nosearch(fileio.html) 1 set nosearch(btreemodule.html) 1 set nosearch(capi3ref.html) 1 set nosearch(changes.html) 1 foreach f [glob *.html] { if {[string match lang_* $f]==0 && [info exists nosearch($f)]==0} { lappend lFiles $f } } foreach f [glob releaselog/*.html] { | > > > > > > > | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | } generic { set nosearch(doc_keyword_crossref.html) 1 set nosearch(doc_backlink_crossref.html) 1 set nosearch(doc_pagelink_crossref.html) 1 set nosearch(doc_target_crossref.html) 1 set nosearch(doclist.html) 1 set nosearch(keyword_index.html) 1 set nosearch(requirements.html) 1 set nosearch(sitemap.html) 1 set nosearch(fileio.html) 1 set nosearch(btreemodule.html) 1 set nosearch(capi3ref.html) 1 set nosearch(changes.html) 1 set nosearch(fileformat2.html) 1 set nosearch(index.html) 1 set nosearch(docs.html) 1 foreach f [glob *.html] { if {[string match lang_* $f]==0 && [info exists nosearch($f)]==0} { lappend lFiles $f } } # "current.html" is a duplicate of the most recent release. set nosearch(releaselog/current.html) 1 foreach f [glob releaselog/*.html] { if {[info exists nosearch($f)]==0} { lappend lFiles $f } } } default { error "document_list: unknown file type $type" } } |
︙ | ︙ | |||
72 73 74 75 76 77 78 | } else { set title [$title_node text] } set title } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | } else { set title [$title_node text] } set title } proc c3ref_document_apis {dom} { set blacklist(sqlite3_int64) 1 set res [list] foreach N [[$dom root] search blockquote] { set text [$N text] while {[regexp {(sqlite3[0-9a-z_]*) *\((.*)} $text -> api text]} { |
︙ | ︙ | |||
147 148 149 150 151 152 153 | } set res [lsort -uniq $res] return [join $res ", "] } | | | | | | | > | > > | > > | | > > > | < > | | < | < > | > > > > > | > > > > > > > > > > > > > > > > | | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | } set res [lsort -uniq $res] return [join $res ", "] } proc c3ref_filterscript {N} { for {set P [$N parent]} {$P!=""} {set P [$P parent]} { if {[$P attr -default "" class]=="nosearch"} { return 0 } if {[$P tag]=="blockquote" } { return 0 } } return 1 } proc lang_filterscript {N} { for {set P [$N parent]} {$P!=""} {set P [$P parent]} { if {[$P attr -default "" class]=="nosearch"} { return 0 } if {[$P tag]=="button" } { return 0 } if {[$P tag]=="a" && [string match syntax/* [$P attr -default "" href]] } { return 0 } } return 1 } proc generic_filterscript {N} { for {set P [$N parent]} {$P!=""} {set P [$P parent]} { if {[$P attr -default "" class]=="nosearch"} { return 0 } } return 1 } proc extract_text_from_dom {dom filterscript} { set text "" set body [lindex [[$dom root] search body] 0] $body foreach_descendent N { if {[$N tag]==""} { if {[eval $filterscript $N]} { append text [$N text] } } } return $text } proc lang_document_import {doc} { set dom [::hdom::parse [readfile $doc]] # Find the <title> tag and extract the title. set title [extract_title $dom $doc] # Extract the entire document text. set text [extract_text_from_dom $dom lang_filterscript] # Insert into the database. insert_entry $doc {} $title $text $dom destroy } proc c3ref_document_import {doc} { set dom [::hdom::parse [readfile $doc]] # Find the <title> tag and extract the title. set title [extract_title $dom $doc] set title "C API: $title" set text [extract_text_from_dom $dom c3ref_filterscript] set apis [c3ref_document_apis $dom] # Insert into the database. insert_entry $doc $apis $title $text } proc generic_document_import {doc} { set dom [::hdom::parse [readfile $doc]] # Find the <title> tag and extract the title. set title [extract_title $dom $doc] set text [extract_text_from_dom $dom generic_filterscript] # Insert into the database. insert_entry $doc {} $title $text } proc rebuild_database {} { |
︙ | ︙ |
Changes to search/search.tcl.
︙ | ︙ | |||
239 240 241 242 243 244 245 | # Set iStart to the index of the first result to display. Results are # indexed starting at zero from most to least relevant. # set iStart [expr {([info exists ::A(i)] ? $::A(i) : 0)*10}] # HTML markup used to highlight keywords within FTS3 generated snippets. # | | > > > | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | # Set iStart to the index of the first result to display. Results are # indexed starting at zero from most to least relevant. # set iStart [expr {([info exists ::A(i)] ? $::A(i) : 0)*10}] # HTML markup used to highlight keywords within FTS3 generated snippets. # #set open {<span style="font-weight:xbold; color:navy">} set open {<span style="background-color:#b3e6cc">} set open {<span style="background-color:#c6ecd9">} set open {<span style="background-color:#d9f2e6">} set close {</span>} set ellipsis {<b> ... </b>} set ret [subst { <table border=0> <p>Search results [expr $iStart+1]..[expr {($nRes < $iStart+10) ? $nRes : $iStart+10}] |
︙ | ︙ | |||
332 333 334 335 336 337 338 | #set env(QUERY_STRING) {q="one+two+three+four"+eleven} set env(QUERY_STRING) {q=windows} set ::HEADER "" } | < > > | | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | #set env(QUERY_STRING) {q="one+two+three+four"+eleven} set env(QUERY_STRING) {q=windows} set ::HEADER "" } if {0==[catch main res]} { set title "Search SQLite Documentation" if {[info exists ::A(q)]} { set initsearch [attrize $::A(q)] append title " - [htmlize $::A(q)]" } else { set initsearch {} } set document [document_header $title "" $initsearch] append document $res } else { set document "<pre>" append document "Error: $res\n\n" append document $::errorInfo append document "</pre>" } |
︙ | ︙ |