Hi Shawn Picking up from the discussion on Stack Overflow as well: http://stackoverflow.com/questions/35992666/no-such-filter-attribute-deleted-at-when-using-thinking-sphinx
Firstly: I’d recommend not adding an alias for the attribute unless there’s a reason for it - so, just `has deleted_at` should be enough. And then, in filters you definitely want to use :deleted_at everywhere, instead of having the confusion of :deleted and :deleted_at both referring to the same value. That said, I know you acknowledged that you’ve run `rake ts:rebuild` since adding the attribute, but it doesn’t seem Sphinx has picked up the new attribute. Can you run `rake ts:stop`, then check that the Sphinx daemon is not running (`ps aux | grep searchd`). If there are still processes, kill them manually, then run `rake ts:index ts:start` and see if that helps. Cheers — Pat > On 17 Mar 2016, at 3:53 AM, Shawn Dibble <[email protected]> wrote: > > I am experiencing some issues with Thinking Sphinx not allowing me to search > by the deleted_at column in my database. > > Essentially, I would like to get a list of all users, active users and > deleted users, then be able to undelete certain users defined by the admin. > Unfortunately, I can't even list the deleted users when using Thinking > Sphinx. When I do a regular search for all users where 'deleted_at IS NOT > NULL', I can get the users. > > I can do any other field in my index just fine, but not deleted_at. Each > time, I get this: > > > > ERROR -- : index user_core: no such filter attribute 'deleted_at' > (ThinkingSphinx::SphinxError) > > This is my index file: > > > > ThinkingSphinx::Index.define :user, :with => :active_record, :delta => true > do > indexes first_name, :sortable => true > indexes last_name, :sortable => true > indexes email, :sortable => true > indexes phone, :sortable => true > has deleted_at, :as => :deleted > has id, :as => :user_id > has roles(:id), :as => :role_ids > set_property :delta => true > end > > > And my query: > > params[:with][:deleted_at] = 0 > > @results = User.search :conditions => params[:conditions], :with => > params[:with], :order => params[:sort] + ' ' + params[:sort_mode], > :page => params[:page], :per_page => params[:per_page], :star => true > > NOTE: Even if I do just @results = User.search, I still get a list of only > all active users where deleted_at is null. I do not seem to be able to get > all users when using Thinking Sphinx. I have also tried > params[:with][:deleted] with similar results. > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/thinking-sphinx > <https://groups.google.com/group/thinking-sphinx>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.
