Full text indexing with Swish-e
Swish-e is a command-line full text indexer similar to ht://Dig. Swish-e sports a brilliant hack. When indexing, one can ask Swish-e to index the output of a command:
* Installation is simple -- it's just a few commands
* Indexing and searching is speedy
* Integration is a breeze, since you are just executing commands.
Discovering Swish-e is like witnessing the birth of Athena, fully grown and ready for battle. I highly recommend it.
There is an important security note for use with websites. I'll post more when I work out the Ruby equivalent of the recommended Perl techniques.
swish-e -S prog -i ./output_documents.rbThe output_documents.rb dumps out a series of html documents:Swish-e is FAST, in every way that matters:#!/usr/bin/ruby
require 'dbi'
require 'pp'
dbh = DBI.connect("dbi:Mysql:test:localhost", "user", "pass")
# get server version string and display it
artbase = dbh.select_all("SELECT * from objects")
artbase.each do |object|
path = '/object/' + object['object_id'].to_s
mtime = object['modified'].to_time.to_i
html = <<HTML
<html>
<title>#{object['title']}</title>
<meta name="author" value="#{object['from_string']}">
<body>
#{object['body']}
</body>
</html>
HTML
print "Path-Name: #{path}\r\n"
print "Last-Mtime: #{mtime}\r\n"
print "Content-Length: #{html.length}\r\n"
print "\r\n"
print html
end
* Installation is simple -- it's just a few commands
* Indexing and searching is speedy
* Integration is a breeze, since you are just executing commands.
Discovering Swish-e is like witnessing the birth of Athena, fully grown and ready for battle. I highly recommend it.
There is an important security note for use with websites. I'll post more when I work out the Ruby equivalent of the recommended Perl techniques.
