Sha256: c3e414c41c829c29505207c6f68eccd89f08e710d9a79a89877dba491c3cb9c8
Contents?: true
Size: 605 Bytes
Versions: 2
Compression:
Stored size: 605 Bytes
Contents
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'sunspot_mongoid' Mongoid.configure do |config| config.master = Mongo::Connection.new.db('sunspot-mongoid-test') end # model class Post include Mongoid::Document field :title include Sunspot::Mongoid sunspot_setup do text :title end end # remove old indexes Post.destroy_all # indexing Post.create(:title => 'foo') Post.create(:title => 'foo bar') Post.create(:title => 'bar baz') # commit Sunspot.commit # search search = Post.search do keywords 'foo' end search.each_hit_with_result do |hit, post| p post end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sunspot_mongoid-0.1.2 | examples/example.rb |
sunspot_mongoid-0.1.1 | examples/example.rb |