Text search in SimpleDB: a Ruby example
You might want to use SimpleDB for storage and to support text indexing and search if you did not want to manually run and administer Solr yourself. Here is a little snippet that shows how to store searchable documents in SimpleDB: require 'rubygems' require 'aws_sdb' SERVICE = AwsSdb::Service.new # assuming that this domain is already created DOMAIN = "some_test_domain_7854854" class Document def initialize name, text words = (name + ' ' + text).downcase.split.uniq attributes = {:words => words, :text => text} SERVICE.put_attributes(DOMAIN, name, attributes) end def Document.search query # The last inject takes the intersection and # insures that all search terms are present: keys = query.downcase.split.collect {|x| SERVICE.query(DOMAIN, "['words' starts-with '#{x}']")[0] }.inject {|x, y| x & y } keys.collect {|key| SERVICE.get_...