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 at
> http://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.