Ruby on rails 如何在sphinx搜索查询中添加条件?
我有一个以价格为属性的产品模型 此查询工作正常,但需要修改的内容很少Ruby on rails 如何在sphinx搜索查询中添加条件?,ruby-on-rails,ruby-on-rails-3,thinking-sphinx,Ruby On Rails,Ruby On Rails 3,Thinking Sphinx,我有一个以价格为属性的产品模型 此查询工作正常,但需要修改的内容很少 @products = Product.search(params[:query], :with => {:price => (params[:price_start].to_s.to_i..params[:price_end].to_s.to_i).to_a}, :page => params[:page], :per_page => 16) 我有一些预定义的价格范围,当前的价格范围是: 1-
@products = Product.search(params[:query], :with => {:price => (params[:price_start].to_s.to_i..params[:price_end].to_s.to_i).to_a}, :page => params[:page], :per_page => 16)
我有一些预定义的价格范围,当前的价格范围是:
- 1-100美元
- 100-300美元
- 300-600美元
- 600多美元
:with => {:price => (params[:price_start].to_s.to_i..params[:price_end].to_s.to_i).to_a}
在(1-100)、(100-300)、(300-600)情况下被判工作罚款。但是如何过滤600多个范围。如何传递查询,如:
:with => {:price > (params[:price_start].to_s.to_i} ie the case when price > 600
我正在验证用户是否正在更改组成长数组的参数
如何修改此查询以传递>和<而不是价格数组。可能是
:without=>{:price=>1..600}
?可能是:without=>{:price=>1..600}
?斯芬克斯只使用范围,不大于/小于符号
在我的应用程序中,我执行以下操作:
value = 23
MyClass.search("itemname", :with => {:price => value..0xffffffff})
斯芬克斯只使用范围,不大于/小于符号 在我的应用程序中,我执行以下操作:
value = 23
MyClass.search("itemname", :with => {:price => value..0xffffffff})