I need to boost Foobars with photos. I have tried the following:
class Foobar < ActiveRecord::Base
searchable do
text :full_name, :as => :full_name_textp
boolean :photo do
self.user.try(:avatar_file_name) != nil ? true : false
end
latlon(:location) { Sunspot::Util::Coordinates.new(latitude, longitude) }
boost { :photo ? 1000 : 1 }
end
end
When I reindex the foobars I get no errors, however, when I search for a local foobar the foobars with photos are not being pushed to the top.
So I couldn't figure out how to accomplish this by boosting (not sure if it's possible), but I was able to declare multiple sorters simultaneously to achieve the result I was looking for.
@dispensers = Dispenser.search do
fulltext params[:search]
with(:location).in_radius(x, y, 15, :bbox => true)
order_by(:photo, :desc)
end