Any idea? I am really stucked :-( On Mar 4, 3:42 pm, rtacconi <[email protected]> wrote: > Wehn I run rake ts:rebuild, with 'has created_at, updated_at, show' I > get: > > Cannot automatically map attribute show in Project to an > equivalent Sphinx type (integer, float, boolean, datetime, string as > ordinal). > You could try to explicitly convert the column's value in your > define_index > block: > has "CAST(column AS INT)", :type => :integer, :as => :column > > Show column in a MySql tinyint(1) > > On Mar 4, 3:19 pm, rtacconi <[email protected]> wrote: > > > I really do not know how to remove the error. Why Sphinx does not find > > 'show' field? > > > On Mar 4, 10:54 am, rtacconi <[email protected]> wrote: > > > > It happens in my mac too, when I am logged out, because it > > > includes :show => true in the conditions (see controller's code) > > > > On Mar 4, 10:51 am, rtacconi <[email protected]> wrote: > > > > > Hi Pat, > > > > > my new search without SQL: > > > > > conditions = (current_user && current_user.is_power? ? {} : {:show > > > > => true}) > > > > conditions["project_type"] = params[:type] if > > > > params[:type].present? > > > > conditions["climate_zone"] = params[:climate] if > > > > params[:climate].present? > > > > @projects = Project.search(params[:search], :page => > > > > params[:page], :per_page => 8, > > > > :conditions => conditions, > > > > :sort_mode => :extended, > > > > :order => "updated_at DESC, created_at > > > > DESC") > > > > @map_projects = @projects.reject {|a| a.lat.blank? || > > > > a.lng.blank? } > > > > @total = @projects.total_entries > > > > > You will see the show property again, I need it to hide hidden > > > > projects to normal users. Show field is in my index (from app/model/ > > > > Project.rb: > > > > > indexes name > > > > indexes summary > > > > indexes description > > > > indexes phone > > > > indexes email > > > > indexes website > > > > indexes climate_zone > > > > indexes city > > > > indexes address > > > > indexes state > > > > indexes post_code > > > > indexes country > > > > indexes project_type > > > > > has created_at, updated_at, show > > > > > indexes posts.created_at, :as => :posts > > > > set_property :delta => true > > > > > Show is a tinyint(1), I am using MySql. In my mac everything is ok but > > > > in production I get 'Production: ThinkingSphinx::SphinxError: index > > > > user_core,user_delta: query error: no field 'show' found in schema'. > > > > Yes I run the rake task, CApistrano daes it at every deployment, but I > > > > tried even manually. I always get that error. > > > > > Any thoughts? > > > > > On Mar 4, 1:12 am, Pat Allan <[email protected]> wrote: > > > > > > Have you run 'rake ts:rebuild' on production? And where in your code > > > > > is the search happening that's causing the error? The same place? > > > > > > -- > > > > > Pat > > > > > > On 04/03/2011, at 6:11 AM, rtacconi wrote: > > > > > > > Actually I figured that out later and I am re-writing the search. > > > > > > Now > > > > > > it is working, but when I deploy in production I still get the error > > > > > > that show field is not found in shema, but is is in the shema nd in > > > > > > the indexes. I re-executed the indexer in production but still the > > > > > > same damn error > > > > > > > On Mar 3, 12:45 pm, Pat Allan <[email protected]> wrote: > > > > > >> Ah, I see... it goes into both SQL, or Sphinx - so if you still > > > > > >> want it to apply to SQL, move it within the else block :) > > > > > > >> -- > > > > > >> Pat > > > > > > >> On 03/03/2011, at 10:42 PM, rtacconi wrote: > > > > > > >>> oh god I though it was SQL instead is going into Shpinx's query. > > > > > > >>> Thanks a lot > > > > > > >>> On Mar 3, 12:30 pm, Pat Allan <[email protected]> wrote: > > > > > >>>> It's because of the first line in your index action: > > > > > > >>>>> conditions = (current_user && current_user.is_power? ? {} : > > > > > >>>>> {:show > > > > > >>>>> => true}) > > > > > > >>>> If a user is logged in and has power, then it adds :show => true > > > > > >>>> to the conditions. Perhaps you want to remove that line? > > > > > > >>>> -- > > > > > >>>> Pat > > > > > > >>>> On 03/03/2011, at 10:24 PM, rtacconi wrote: > > > > > > >>>>> Hi, > > > > > > >>>>> I have this code (developed by someone else: > > > > > > >>>>> def index > > > > > >>>>> conditions = (current_user && current_user.is_power? ? {} : > > > > > >>>>> {:show > > > > > >>>>> => true}) > > > > > >>>>> if params[:search] > > > > > >>>>> conditions = conditions.merge({:home_climate_zones => > > > > > >>>>> params[:climate_zone]}) if params[:climate_zone].present? > > > > > >>>>> @users = User.search(params[:search] || "", :conditions => > > > > > >>>>> conditions ) > > > > > >>>>> @users = @users.select {|u| > > > > > >>>>> u.has_user_type?(params[:type])} if > > > > > >>>>> params[:type].present? > > > > > >>>>> @total = @users.size > > > > > >>>>> @users = @users.sort_by {|e| > > > > > >>>>> [e.posts.last.try(:created_at) || > > > > > >>>>> 10.years.ago] }.reverse > > > > > >>>>> @users = @users.paginate(:per_page => 9, :page => > > > > > >>>>> params[:page] > > > > > >>>>> || 1) > > > > > >>>>> else > > > > > >>>>> @users = User.paginate(:conditions => conditions, > > > > > >>>>> :per_page => > > > > > >>>>> 9, :page => params[:page], :include => :posts, :order => > > > > > >>>>> "posts.created_at DESC, users.created_at DESC") # Not you! > > > > > >>>>> @total = User.count > > > > > >>>>> end > > > > > >>>>> @featured = User.featured > > > > > >>>>> @map_users = User.with_lat_lng.all(:select => 'id, lat, > > > > > >>>>> lng', :include => :posts, :order => "posts.created_at DESC") > > > > > >>>>> end > > > > > > >>>>> The output of the rebuild: > > > > > > >>>>> indexing index 'project_core'... > > > > > >>>>> collected 234 docs, 0.9 MB > > > > > >>>>> sorted 0.1 Mhits, 100.0% done > > > > > >>>>> total 234 docs, 870847 bytes > > > > > >>>>> total 0.454 sec, 1917016 bytes/sec, 515.10 docs/sec > > > > > >>>>> indexing index 'project_delta'... > > > > > >>>>> collected 0 docs, 0.0 MB > > > > > >>>>> total 0 docs, 0 bytes > > > > > >>>>> total 0.011 sec, 0 bytes/sec, 0.00 docs/sec > > > > > >>>>> distributed index 'project' can not be directly indexed; > > > > > >>>>> skipping. > > > > > >>>>> indexing index 'user_core'... > > > > > >>>>> collected 722 docs, 0.0 MB > > > > > >>>>> sorted 0.0 Mhits, 100.0% done > > > > > >>>>> total 722 docs, 26907 bytes > > > > > >>>>> total 0.036 sec, 727570 bytes/sec, 19523.01 docs/sec > > > > > >>>>> distributed index 'user' can not be directly indexed; skipping. > > > > > >>>>> total 10 reads, 0.002 sec, 50.8 kb/call avg, 0.2 msec/call avg > > > > > >>>>> total 21 writes, 0.001 sec, 55.9 kb/call avg, 0.0 msec/call avg > > > > > >>>>> Started successfully (pid 3304). > > > > > > >>>>> I want to mention the show is a user field but it is a reserved > > > > > >>>>> word > > > > > >>>>> in Mysql. I have been thinking to rename it, but I still do not > > > > > >>>>> understand why Shinx is 'interested' in the show field. > > > > > > >>>>> On Mar 3, 12:19 pm, Pat Allan <[email protected]> wrote: > > > > > >>>>>> What is your search query? And what's the output when you run > > > > > >>>>>> ts:rebuild? > > > > > > >>>>>> -- > > > > > >>>>>> Pat > > > > > > >>>>>> On 03/03/2011, at 10:08 PM, rtacconi wrote: > > > > > > >>>>>>> I the Usr model I have the following index > > > > > > >>>>>>> define_index do > > > > > >>>>>>> indexes first_name, :sortable => true > > > > > >>>>>>> indexes last_name, :sortable => true > > > > > >>>>>>> indexes city > > > > > >>>>>>> indexes state > > > > > >>>>>>> indexes country > > > > > >>>>>>> # indexes aid_work > > > > > >>>>>>> # indexes consultant > > > > > >>>>>>> # indexes home_climate_zones > > > > > >>>>>>> # indexes pdc_teacher > > > > > >>>>>>> # has show > > > > > > >>>>>>> set_property :delta => true > > > > > > >>>>>>> # indexes posts.created_at, :as => :posts > > > > > >>>>>>> end > > > > > > >>>>>>> I am getting this error: > > > > > > >>>>>>> index user_core,user_delta: query error: no field 'show' > > > > > >>>>>>> found in > > > > > >>>>>>> schema > > > > > > >>>>>>> I rebuild the index but still getting that error. Any idea > > > > > >>>>>>> why? > > > > > > >>>>>>> -- > > > > > >>>>>>> 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 > > > > > >>>>> 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 > > > > > >>> 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 > > ... > > read more »
-- 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.
