Hi Bryan
I think the bug you're getting has been fixed in 1.2.4 and later - can
you update TS and see if that helps?
Cheers
--
Pat
On 18/08/2009, at 12:21 AM, mrpunkin wrote:
>
> Rails is 2.3.3, Ruby 1.8.4, TS is 1.2.1
>
> Index code is as follows...
>
> def latitude; prim_lat_dec; end;
> def longitude; prim_lon_dec; end;
>
> KM_TO_MI = 0.621371192
>
> define_index do
> # fields
> indexes name, :sortable=>true
> indexes state
> indexes county
>
> has 'RADIANS(prim_lat_dec)', :as => :lat, :type => :float
> has 'RADIANS(prim_lon_dec)', :as => :lon, :type => :float
> set_property :latitude_attr => 'lat'
> set_property :longitude_attr => 'lon'
>
> set_property :field_weights => {"name" => 10, "county" => 5,
> "state" => 2}
> set_property :enable_star => 1
> set_property :min_prefix_len => 2
> end
>
> method code is...
>
> def search_nearby(q, options={})
> radius = options[:radius] || 10
> rad_meters = radius.to_f/KM_TO_MI*1000.0
>
> default_options = {
> :geo => [latitude*Math::PI/180.0, longitude*Math::PI/180.0],
> :with=>{"@geodist"=>0.0..rad_meters}
> }
> options = default_options.merge options
> return self.class.search(q, options)
> end
>
> On Aug 14, 6:19 pm, James Healy <[email protected]> wrote:
>> What versions of ruby, rails and thinking sphinx are you running?
>>
>> What does the relevant define_index block look like, and can you
>> provide
>> the code that triggers this error?
>>
>> -- James Healy <jimmy-at-deefa-dot-com> Sat, 15 Aug 2009 11:18:23
>> +1000
>>
>> mrpunkin wrote:
>>
>>> Hello all,
>>
>>> I have a problem with my search using geo information. It was
>>> working
>>> a while back but now is tossing an error, even with old unchanged
>>> code. Can anyone possibly offer some advice why I would keep getting
>>> the following error when trying to pass geo data?
>>
>>> NoMethodError: You have a nil object when you didn't expect it!
>>> The error occurred while evaluating nil.bytesize
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/vendor/plugins/thinking-
>>> sphinx/lib/../vendor/riddle/lib/riddle/client/message.rb:21:in
>>> `send'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/vendor/plugins/thinking-
>>> sphinx/lib/../vendor/riddle/lib/riddle/client/message.rb:21:in
>>> `append_string'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/vendor/plugins/thinking-
>>> sphinx/lib/../vendor/riddle/lib/riddle/client.rb:531:in
>>> `query_message'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/vendor/plugins/thinking-
>>> sphinx/lib/../vendor/riddle/lib/riddle/client.rb:286:in `query'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/vendor/plugins/thinking-
>>> sphinx/lib/thinking_sphinx/search.rb:203:in `populate'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/vendor/plugins/thinking-
>>> sphinx/lib/thinking_sphinx/search.rb:279:in `call'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/vendor/plugins/thinking-
>>> sphinx/lib/thinking_sphinx/search.rb:279:in `retry_on_stale_index'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/vendor/plugins/thinking-
>>> sphinx/lib/thinking_sphinx/search.rb:200:in `populate'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/vendor/plugins/thinking-
>>> sphinx/lib/thinking_sphinx/search.rb:149:in `total_entries'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/app/models/place.rb:65:in
>>> `search'
>>> from /Users/Bryan/Sites/rubyapps/pc_3.0/app/models/place.rb:44:in
>>> `search_nearby'
>>> from (irb):94
>>
>>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---