Sha256: 51594e755ce319b6a9fe335e10d6701afc31e0d13fef974ad2b710f0e0f0c667

Contents?: true

Size: 1.05 KB

Versions: 11

Compression:

Stored size: 1.05 KB

Contents

class Photo < MockRecord
  attr_accessor :caption, :description, :lat, :lng, :size, :average_rating, :created_at, :post_id, :photo_container_id
end

Sunspot.setup(Photo) do
  text :caption, :default_boost => 1.5
  text :description
  string :caption
  integer :photo_container_id
  boost 0.75
  integer :size, :trie => true
  float :average_rating, :trie => true
  time :created_at, :trie => true
end

class PhotoContainer < MockRecord
  attr_accessor :description

  def id
    1
  end
end

Sunspot.setup(PhotoContainer) do
  integer :id
  text :description, :default_boost => 1.2

  join(:caption, :target => Photo, :type => :string, :join => { :from => :photo_container_id, :to => :id })
  join(:photo_rating, :target => Photo, :type => :trie_float, :join => { :from => :photo_container_id, :to => :id }, :as => 'average_rating_ft')
  join(:caption, :target => Photo, :type => :text, :join => { :from => :photo_container_id, :to => :id })
  join(:description, :prefix => "photo", :target => Photo, :type => :text, :join => { :from => :photo_container_id, :to => :id })
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
sunspot-2.3.0 spec/mocks/photo.rb
sunspot-2.2.8 spec/mocks/photo.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sunspot-2.2.7/spec/mocks/photo.rb
sunspot-2.2.7 spec/mocks/photo.rb
sunspot-2.2.6 spec/mocks/photo.rb
sunspot-2.2.5 spec/mocks/photo.rb
sunspot-2.2.4 spec/mocks/photo.rb
sunspot-2.2.3 spec/mocks/photo.rb
sunspot-2.2.2 spec/mocks/photo.rb
sunspot-2.2.1 spec/mocks/photo.rb
sunspot-2.2.0 spec/mocks/photo.rb