[schlenk] 2006-06-01: These two scripts provide a simple search facility for the wiki based on the [xapian] package. It could easily be extended into a website providing a better fulltext search for the Tcl'ers wiki. ---- '''The indexer''' #!/usr/bin/env tclsh # # Index the Tcl'ers Wiki # # (c) 2006 Michael Schlenker word]} { set i [lindex $word 0] set j [lindex $word 1] if {($j-$i) <= $::MAX_PROB_TERM_LENGTH} { set term [string range $text $i $j] set term [string tolower $term] set sterm [estem stem_word $term] log_debug "Indexing $term" $doc add_posting $term $pos incr pos $doc add_term $sterm } incr j } return $pos } proc openIndexDatabase {file} { xapian::WritableDatabase xapiandb $file $::xapian::DB_CREATE_OR_OVERWRITE xapian::Stem estem "english" return xapiandb } proc closeIndexDatabase {db} { $db -delete } indexWiki $wikifile ---- '''The simple command line searching utility''' #!/usr/bin/env tclsh # # Search the Wiki # # (c) 2006 Michael Schlenker ./gsearch.tcl schlenk and xapian [Do Jun 01 23:36:02 CEST 2006] [wsearch] [info] 'Using Xapian API version 0.9.6' [Do Jun 01 23:36:02 CEST 2006] [wsearch] [info] 'Commandline is schlenk and xapian' [Do Jun 01 23:36:02 CEST 2006] [wsearch] [debug] 'Building query' [Do Jun 01 23:36:02 CEST 2006] [wsearch] [debug] 'Performing query Xapian::Query((schlenk:(pos=1) OR and:(pos=2) OR xapian:(pos=3)))'' [Do Jun 01 23:36:02 CEST 2006] [wsearch] [info] '6330 results found' ID 6873 100% [http://wiki.tcl.tk/13173 Xapian] ID 8077 96% [http://wiki.tcl.tk/15637 {Package feature map}] ID 34 47% [http://wiki.tcl.tk/35 {New Pages}] ID 2296 46% [http://wiki.tcl.tk/3068 {Michael Schlenker}] ---- [Category Wikit]