Hi there - i''m looking for anyone who ''s experienced inconsistent behaviour in ferret: The search engine is somewhat temperamental, some words are returned, and some result in a 500 server error... the error in the log is as follows:. (this is straight off the production log: ** What''s confusing, is that the engine does return some results, but not always.. I know some words exist in the database, and I have also reset the ferret server. Processing BuddiesController#search (for 86.150.12.191 at 2010-01-23 18:06:44) [GET] Parameters: {"q"=>"craig"} NoMethodError (undefined method `info'' for nil:NilClass): app/controllers/buddies_controller.rb:55:in `search'' app/controllers/buddies_controller.rb:55:in `search'' /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'' /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb: 207:in `main_loop'' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 385:in `start_request_handler'' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 343:in `handle_spawn_application'' /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 341:in `handle_spawn_application'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 209:in `start'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: 126:in `lookup_or_add'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: 80:in `synchronize'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: 79:in `synchronize'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'' /usr/lib/phusion_passenger/passenger-spawn-server:61 Rendering /srv/pistebuddies.com/public/public/500.html (500 Internal Server Error) Any ideas? Many Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 January 2010 18:17, RubyonRails_newbie <craigwesty79-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Hi there - i''m looking for anyone who ''s experienced inconsistent > behaviour in ferret: > > The search engine is somewhat temperamental, some words are returned, > and some result in a 500 server error... > > the error in the log is as follows:. (this is straight off the > production log: > > ** What''s confusing, is that the engine does return some results, but > not always.. I know some words exist in the database, and I have also > reset the ferret server. > > Processing BuddiesController#search (for 86.150.12.191 at 2010-01-23 > 18:06:44) [GET] > Parameters: {"q"=>"craig"} > > NoMethodError (undefined method `info'' for nil:NilClass): > app/controllers/buddies_controller.rb:55:in `search''It appears that in line 55 of buddies_controller.rb you are calling something.info where something is nil (the clue is in the error message). Have a look to see why it might be nil. Post the code here if you cannot see it. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Colin, I''ve been searching the code, but not 100% sure what''s up. It was ok in dev, so can''t explain it.. :-) line 55 is this line here: users.each { |user| user.info ||Info.new } Here''s the full code from the buddies_controller: def search @title = "Find Buddies" if params[:q] query = params[:q] curr_page = params[:page] || 1 users = User.find_with_ferret(query) infos = Info.find_with_ferret(query) hits = infos users.concat(hits.collect { |hit| hit.user }).uniq! users.each { |user| user.info ||= Info.new } users = users.sort_by { |user| user.info.last_name } @buddies = users.paginate(:page => curr_page, :per_page => 5) end end Many, Many thanks!! On 23 Jan, 20:32, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 January 2010 18:17, RubyonRails_newbie > > > > > > <craigwest...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > Hi there - i''m looking for anyone who ''s experienced inconsistent > > behaviour in ferret: > > > The search engine is somewhat temperamental, some words are returned, > > and some result in a 500 server error... > > > the error in the log is as follows:. (this is straight off the > > production log: > > > ** What''s confusing, is that the engine does return some results, but > > not always.. I know some words exist in the database, and I have also > > reset the ferret server. > > > Processing BuddiesController#search (for 86.150.12.191 at 2010-01-23 > > 18:06:44) [GET] > > Parameters: {"q"=>"craig"} > > > NoMethodError (undefined method `info'' for nil:NilClass): > > app/controllers/buddies_controller.rb:55:in `search'' > > It appears that in line 55 of buddies_controller.rb you are calling > something.info where something is nil (the clue is in the error > message). Have a look to see why it might be nil. Post the code > here if you cannot see it. > > Colin-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/1/24 RubyonRails_newbie <craigwesty79-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>:> Hi Colin, > > I''ve been searching the code, but not 100% sure what''s up. It was ok > in dev, so can''t explain it.. :-) > > line 55 is this line here: users.each { |user| user.info ||> Info.new } > > Here''s the full code from the buddies_controller: > > > > def search > @title = "Find Buddies" > if params[:q] > query = params[:q] > curr_page = params[:page] || 1 > users = User.find_with_ferret(query) > infos = Info.find_with_ferret(query) > hits = infos > users.concat(hits.collect { |hit| hit.user }).uniq! > > users.each { |user| user.info ||= Info.new }It appears that one of the users is nil. Have a look at the Rails Guide on debugging and use ruby-debug to break into here (you can run it in production mode with the debugger) and inspect the variables and see what is happening. Is is possible that the concat call is appending a nil element? Colin> users = users.sort_by { |user| user.info.last_name } > @buddies = users.paginate(:page => curr_page, :per_page => 5) > end > end > > Many, Many thanks!! > > > > On 23 Jan, 20:32, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 23 January 2010 18:17, RubyonRails_newbie >> >> >> >> >> >> <craigwest...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> > Hi there - i''m looking for anyone who ''s experienced inconsistent >> > behaviour in ferret: >> >> > The search engine is somewhat temperamental, some words are returned, >> > and some result in a 500 server error... >> >> > the error in the log is as follows:. (this is straight off the >> > production log: >> >> > ** What''s confusing, is that the engine does return some results, but >> > not always.. I know some words exist in the database, and I have also >> > reset the ferret server. >> >> > Processing BuddiesController#search (for 86.150.12.191 at 2010-01-23 >> > 18:06:44) [GET] >> > Parameters: {"q"=>"craig"} >> >> > NoMethodError (undefined method `info'' for nil:NilClass): >> > app/controllers/buddies_controller.rb:55:in `search'' >> >> It appears that in line 55 of buddies_controller.rb you are calling >> something.info where something is nil (the clue is in the error >> message). Have a look to see why it might be nil. Post the code >> here if you cannot see it. >> >> Colin > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.