Sha256: 35d61df5e0b4138db8b796b41af0ba8e9605b5d4c6b8eadc19c9dfc3c155353a
Contents?: true
Size: 877 Bytes
Versions: 2
Compression:
Stored size: 877 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 using the pagination gem with this: @items = Lunar.search(Item, "iphone") paginate @items, :per_page => 10, :page => 1 "Lunar:Item:cost:2300"
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lunar-0.2.1 | examples/ohm.rb |
lunar-0.2.0 | examples/ohm.rb |