What to do with missing fields in sunspot-rails?
- by chrismealy
I'm using sunspot/rails version 2. It's working great, but I can't figure out how to handle missing fields. If I don't have latitude and longitude this code will map it to 0,0 (near Africa):
searchable do
text :resume, :stored => true
text :city, :boost => 5
latlon(:geo) { Sunspot::Util::Coordinates.new(latitude, longitude) }
end
I tried using two search blocks, each with a different conditional, but sunspot just uses the first searchable block. What I want to happen is for things missing locations to still be searchable, just not by location.