如何使用嵌套包含构建对Solr(太阳黑子)的搜索请求

时间:2015-11-12 12:37:12

标签: ruby-on-rails solr sunspot

Rails 4.2.8。
Solr的
太阳黑子

原始请求是

@orders = current_user
  .customer
  .orders
  .includes(
    address: { delivery_zone: :franchise },
    restaurant_orders: { restaurant: :franchise },
    ordered_items: :menu_item
  )
  .order(created_at: :desc)

Solr搜索请求

@orders = Order.search do
  fulltext params[:query] if params[:query]
  with :customer_id, current_user.customer.id
  order_by :id, params[:sort] || :desc
  paginate :page => params[:page] || 1, :per_page => 10

如何重新构建Solr搜索请求以添加

  .includes(
    address: { delivery_zone: :franchise },
    restaurant_orders: { restaurant: :franchise },
    ordered_items: :menu_item
  )

提前致谢。

0 个答案:

没有答案