It seemed to be because the controller method was being called via AJAX. Once I reverted to a plain vanilla HTML request it started working.
On Mar 16, 6:50 pm, Pat Allan <[email protected]> wrote: > Hi Veet > > This doesn't seem like a TS issue - if it's rendering a 404, then it's very > likely not even hitting the blog_search_results method in your controller. > > Can you spot anything in your controller that might be stopping the action > from happening in production? > > -- > Pat > > On 16/03/2011, at 3:03 PM, Veet wrote: > > > Environment Rails 3.0.4, Ruby 1.8.7, Sphinx 0.99, Dreamhost VPS, > > Thinking Sphinx 2.0.2 > > > I have a simple blog search set up as follows: > > > Controller: > > > def blog_search_results > > @blog_search_results = BlogPost.search( params[:search_param] ) > > respond_to do |format| > > format.html { render :partial => > > 'blog_search_results', :layout=>false } > > format.xml { render :xml => @blog_search_results } > > end > > end > > > View: > > > <% if !@blog_search_results.empty? %> > > <div id="main_content"> > > <table id="pending_blog_list"><tr id="header"><td>Blog > > Title</ > > td><td>Created by</td><td>Created on</td></tr> > > <% @blog_search_results.each do |blog_post| %> > > <tr> > > <td><%= link_to blog_post.title, > > blog_named_link(blog_post, :show) %></td> > > <td><%= blog_post.posted_by.display_name > > -%></td> > > <td><%= > > blog_post.created_at.strftime("%x") -%></td> > > </tr> > > <% end %> > > </table> > > <%= will_paginate(@blog_search_results, {:form_name > > => :blog_show_params, :param_name => :page} ) %> > > </div> > > <% else %> > > <h2>No blog posts that match your search were found</h2> > > <% end %> > > > Everything works perfectly in my development environment. In the > > production environment, when I launch a console ("rails c production") > > and type: > > >> irb(main):003:0> > >> BlogPost.search("video") > > > I get the expected 4 results of posts with the word 'video'. However > > in the actual app, the controller keeps returning a '404 Not Found' > > > Started GET "/blog_posts/blog_search_results?search_param=video" > > Processing by BlogPostsController#blog_search_resul as HTML > > Parameters: {"search_param"=>"video"} > > Completed in 27ms > > Rendered layouts/application.html.erb (22.3ms) > > Rendered public/404.html within layouts/blog_posts (24.7ms) > > > My sphinx.yml setup is as follows: > > > staging: > > pid_file: '/www.assetcorr.com/current/log/searchd.pid' > > searchd_file_path: 'www.assetcorr.com/shared/db/sphinx' > > bin_path: '/home/avitus/local/bin' > > > I see the index in the in the shared/db/sphinx folder. It appears > > after I run ts:index. > > The searchd.pid file is in the log folder and the PID matches the > > searchd daemon. > > The bin_path is correct and I've added it to the path in > > the .bash_profile file. > > > In the searchd.log file I only see the queries from the console, not > > from within the app. > > > Does anyone have any ideas what could be causing this? > > > One thing I noticed in my dev environment (where everything is working > > ok) is: > > > --- > > Riddle cannot detect Sphinx on your machine, and so can't determine > > which > > version of Sphinx you are planning on using. Please use one of the > > following > > lines after "require 'riddle'" to avoid this warning. > > > require 'riddle/0.9.8' > > # or > > require 'riddle/0.9.9' > > # or > > require 'riddle/1.10' > > --- > > > Not sure whether that could be causing a problem. I have Riddle 1.2.2 > > installed as a gem. > > > -- > > 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 > > athttp://groups.google.com/group/thinking-sphinx?hl=en. > > -- 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.
