如何在sphinx中组织范围搜索

时间:2012-12-28 06:17:44

标签: ruby-on-rails ruby-on-rails-3 sphinx thinking-sphinx

我在表单中有两个范围字段。 最小和最大字段。

= form_tag search_items_path, :method => :get do
  %label
    = t('form.price')
  = text_field_tag :min_price, params[:min_price]
  = text_field_tag :max_price, params[:max_price]

  = submit_tag t('form.search')


= render "search_result"

如何在sphinx中组织范围搜索?

1 个答案:

答案 0 :(得分:0)

define_index do
  indexes name

  has mileage
end
Car.search :with => {:mileage => 100..150000}