从Tire迁移到Elasticsearch-rails,如何翻译搜索块?

时间:2014-09-25 16:21:44

标签: ruby-on-rails mongodb elasticsearch tire

我最终将Tire升级到Elasticsearch-rails并且无法找到如何将其转换为另一个的示例。这是我的旧查询:

s = Item.tire.search do
  query { string query.query } if query.query.to_s.length > 0
  page = search_page
  min_score  Setting.get("elastic search min score", "0.1").to_f
  search_size = query_search_size
  from (page -1) * search_size
  size search_size
  filter :term, real_sale: true
  filter :terms, :retailer_id => [query.retailer_id] if query.retailer_id
  filter :not, {:exists => {:field => :location_ids} } if location_ids.nil?
  filter :terms, :location_ids => location_ids if not location_ids.nil?
end

我没有看到任何关于如何在Elasticsearch-rails中执行块的文档,有人能指出我正确的方向吗?我已经尝试了显而易见的,用弹性搜索替换轮胎,只搜索,但这些都没有。

感谢您的帮助, 凯文

0 个答案:

没有答案