Search works in dev but not in prod?

Is there any reason for a search page that searches through events for a keyword and then displays those that contain the keyword to not give any results in production when it does in development? I've made sure I'm searching terms that should give me results in production, but it's like it's not searching through the events at all or something.

Ar Chron wrote:

Check or turn on your logging in Production to see what's going on.

In my dev log I get a whole bunch of stuff from checkin each event for the keywords (i think thats what its doin):

Processing SearchController#keyword (for 127.0.0.1 at 2008-06-03 16:29:17) [POST]   Session ID: bc95e3751aa213c624c33af71a846c8c   Parameters: {"commit"=>"Search", "text"=>"test", "order"=>"created_on", "action"=>"keyword", "method"=>"post", "controller"=>"search", "search_auds"=>"1", "search_streams"=>"1"} e[4;36;1mCalendar Load (0.001025)e[0m e[0;1mSELECT * FROM calendars WHERE (hidden=0) e[0m   e[4;35;1mCalendar Columns (0.002512)e[0m e[0mSHOW FIELDS FROM calendarse[0m   e[4;36;1mCalendar Load (0.001113)e[0m e[0;1mSELECT * FROM calendars WHERE (hidden=0) e[0m   e[4;35;1mStream Columns (0.002510)e[0m e[0mSHOW FIELDS FROM calendarse[0m   e[4;36;1mEvent Columns (0.002639)e[0m e[0;1mSHOW FIELDS FROM eventse[0m   e[4;35;1mStamp Columns (0.001862)e[0m e[0mSHOW FIELDS FROM stampse[0m

....

In the production log I just get:

Processing SearchController#keyword [POST]   Session ID: a0db357e9a9aaec2298535c55618f688   Parameters: {"commit"=>"Search", "text"=>"test", "order"=>"created_on", "action"=>"keyword", "method"=>"post", "controller"=>"search", "search_auds"=>"1", "search_streams"=>"1"} Rendering within layouts/application Rendering search/keyword Completed in 0.15170

So it doesn't even check for the keywords in the events?

I believe you need to turn on debug for your production environment to see more.

Something like this in your production.rb should give you most of "production" behaviors, but you'll still get debug.

# Show full error reports and enable caching config.log_level = :debug config.action_controller.consider_all_requests_local = true config.action_controller.perform_caching = true config.action_view.cache_template_extensions = true config.action_view.debug_rjs = true

I always add

config.active_record.colorize_logging = false

to get rid of the unreadable e[4;35;1mS stuff

You do this in your environment configuration file, in this case config/environments/production.conf

Serge

Thanks a lot for that, now I can see that it is finding some events...but only past events (dated before today), and not displaying them (this is what it's supposed to do)...but it should also be finding events for today and the future and displaying them. I think there might be something wrong in the base condition in the event search method:

def self.search(search_streams, search_auds, keywords, options = {}, *args)

  default_options = {     "calendars" => Calendar.find_public,     :status => :approved   }

  options = default_options.merge(options)

  if keywords.nil? or keywords == ""     t = "%" + keywords.to_s.gsub(/\s/, '%') + "%"     base_condition = ["(title like ? OR body like ? OR location like ?)", t, t, t]   else     t = (keywords.split(" ").collect { |x| "[[:<:]]" + x + "[[:>:]]" }).join("|")     base_condition = ["(title regexp ? OR body regexp ? OR location regexp ?)", t, t, t]    end

   events =    streams =    audiences =

   options["calendars"].each do |c|      audiences << c if c.is_a?(Audience)      streams << c if c.is_a?(Stream)    end

   if search_streams == "1"

     for cal in streams

  base_condition[0] += ' AND stamps.calendar_id = ? AND stamps.status = ?'          base_condition += [cal.id, Stamp::STATUS[options[:status]]]          e = Event.find(:all, :conditions => base_condition, :include => :stamps)              events += e      end    end

   if search_auds == "1"

      for cal in audiences         base_condition[0] += " AND audiences_events.audience_id = ?"         base_condition << cal.id         # explicitly written joins instead of using the :include option         # the :include option creates an invalid SQL statement         e = Event.find(:all, :conditions => base_condition, :include => :stamps,         :joins => 'LEFT OUTER JOIN audiences_events ON audiences_events.event_id = events.id LEFT OUTER JOIN calendars ON calendars.id = audiences_events.audience_id')         events += e       end    end

   events.uniq!

Do you see anything there that would work properly in development but not in production? Thanks a lot for your help!

Does anyone have any suggestions? I'm completely stuck on this and my logs aren't showing me anything that would help.

Okay so I figured out that if i comment out the 2 lines:

base_condition[0] +=' AND stamps.calendar_id = ? AND stamps.status = ?'

base_condition += [cal.id, Stamp::STATUS[options[:status]]]

Then the search finds and displays the events like it should...anyone know why this is? I don't get it