!= not working in search query (thinking sphinx)

I have a int field in my database and would like to check if it’s not
0. Apparently the != in the condition is not working. I’m I doing
something wrong? I tried different ways with no luck. Can anyone help?

these are the options I tried

@allPost = Post.search params[:search], :conditions => 
[“account_status
!= 0”]
@ allPost = Post.search params[:search], :conditions =>

[“account_status != ?”, 0]
@ allPost = Post.search params[:search], :conditions =>

[“account_status IS NOT ?”, 0]
@ allPost = Post.search params[:search], :conditions =>

[“account_status < ?”, 1]

thanks

Looks like I am one step ahead of you Sam, I learned this one yesterday:

http://www.ruby-forum.com/topic/187676#new

Look a few posts down for the series of “67 != 67”

Anyway, the problem is that w/ a HTTP request everything is received as
a string. So:

account_status.to_i

Still not working. I tried

@ allPost = Post.search params[:search], :conditions
=>[“account_status.to_i != ?”, 0]

@ allPost = Post.search params[:search], :conditions
=>“account_status.to_i != 0”

Mk 27 wrote:

Looks like I am one step ahead of you Sam, I learned this one yesterday:

How to pass parameters with remote_function - Rails - Ruby-Forum

Look a few posts down for the series of “67 != 67”

Anyway, the problem is that w/ a HTTP request everything is received as
a string. So:

account_status.to_i

On May 24, 5:22 pm, Sam G. [email protected]
wrote:

Still not working. I tried

@ allPost = Post.search params[:search], :conditions
=>[“account_status.to_i != ?”, 0]

@ allPost = Post.search params[:search], :conditions
=>“account_status.to_i != 0”

Have a look at the documentation for sphinx/thinking sphinx - this
isn’t activerecord any more, or SQL. To quote the thinking sphinx
docs:

Please keep in mind that Sphinx does not support SQL comparison operators – it has its own query language. The
:conditions option must be a hash, with each key a field and each value a string.

In addition, :conditions is for doing full text searches against
specific columns you have indexed - for filtering on attribute values
you need to use the :with option.

Fred