Sha256: 0036953750b687b95d7b34820af6c800fd5dfa1229f3b88e64fbf559798e2bab
Contents?: true
Size: 938 Bytes
Versions: 5
Compression:
Stored size: 938 Bytes
Contents
class Item < Ohm::Model attribute :name attribute :description def index Lunar::Index.create 'Item' do |i| i.key id i.attr :name, name i.attr :description, description end # You can also do this, no problem Lunar::Index.create Item do |i| i.key id i.attr :name, name i.attr :description, description end # Or to avoid name ties... Lunar::Index.create self.class do |i| i.key id i.attr :name, name i.attr :description, description end end end # Searching... # You can just straight out search keywords Lunar.search(Item, "iphone") # Or opt to filter by field Lunar.search(Item, :name => "iphone", :description => "mobile") # Or search a field using an array Lunar.search(Item, :name => ["iphone", "apple"]) # Or using the pagination gem with this: @items = Lunar.search(Item, "iphone") paginate @items, :per_page => 10, :page => 1
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
lunar-0.4.1 | examples/ohm.rb |
lunar-0.4.0 | examples/ohm.rb |
lunar-0.3.0 | examples/ohm.rb |
lunar-0.2.3 | examples/ohm.rb |
lunar-0.2.2 | examples/ohm.rb |