ankane / searchkick

Intelligent search made easy
MIT License
6.55k stars 760 forks source link

Eagerload Multiple Tables #1407

Closed berniechiu closed 4 years ago

berniechiu commented 4 years ago

Hi @ankane , I wonder if it's possible to eager multiple tables since we can do this in Rails

Like the example here subscription: :plan

Company.includes(:balance, subscription: :plan).each { ... }

But not sure how we can achieve this in Searchkick, the description doesn't say much here

Product.search "milk", includes: [:brand, :stores]

Thanks!

ankane commented 4 years ago

Hey @berniechiu, you can do:

Product.search "milk", includes: [:balance, {subscription: :plan}]
berniechiu commented 4 years ago

Thx a lot!