Sunspot Solr Rails geosearch is failing with undefined method error -
i'm new using sunspot gem. have installed , correctly indexing , querying. however, trying bound search parameters including geo search. database table indexed solr has latitude , longitude fields i'm unable geo-search working.
here's have in model:
searchable . . . double :latitude, :as => "lat" double :longitude, :as => "lon" location (:location) { sunspot::util::coordinates.new(lat, lon) } end
however when run rake task reindex fails following:
undefined method `lat' #<product:0x1076e6650>
i've tried:
latlon(:location){ sunspot::util::coordinates.new(lat, lon) }
and
location(:location){ sunspot::util::coordinates.new(:latitude, :longitude) }
i've tried various different options such passing in :latitude , :longitude rather lat, lon seem running different errors each time.
i've got following gems installed: sunspot (2.0.0, 1.3.3, 1.2.1) sunspot_rails (1.3.3, 1.2.1) sunspot_solr (2.0.0)
any suggestions appreciated! in advance.
i figured out. here's correct way it:
searchable . . . double :latitude double :longitude location (:location) { sunspot::util::coordinates.new(latitude, longitude) } end
Comments
Post a Comment