Sphinx doesn''t have the concept of greater or less than for filters -
not in a simple sense, anyway. The easiest approach is to have a range
between 1000 and a really big number (given it''s an integer, perhaps
2^32):
Product.search :with => {:price => 1000..(2**32)}
Give that a shot.
--
Pat
On Apr 14, 6:43 pm, Vasin Alexander
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
wrote:> Is a model of products with the indices
>
> define_index do
> indexes: name
> indexes description
> has product_shops.price,: as =>: price
> has catalog_product_connections.catalog_id,: as =>: catalog_id
> end
>
> Need ability to filter by price.
>
> The controller write this:
>
> Product.search('''', :with => {:price => params[:
> price_from].to_i..params[:price_to].to_i})
>
> It works.
> But how to specify the query type: price > 1000?
> I have tried this:
>
> Product.search('''', :with =>
[''price>?'', params[: price_from]])
>
> getting error
> searchd error (status: 1): invalid or truncated request
>
> What to do?
>
> --
> Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.