searchkick icon indicating copy to clipboard operation
searchkick copied to clipboard

Unscope the search_import scope in-case I'm indexing some attrs,

Open wahabmangat opened this issue 1 year ago • 1 comments

First Done Is your feature request related to a problem? Please describe. I have a search_import scope like

  scope :search_import, -> { includes(:apps) }

I don't want to eager_load the apps when I'm only indexing let's say the domain name (FYI: domain has_many apps). How to unscope it

here's my search_data method

def search_data
  {
   apps_name: apps.map(&:name)
  }.merge(only_name)
end
def only_name
  {
    name: name
  }
end

Describe the solution you'd like

Domain.unscope(:search_import).reindex(:only_name)

wahabmangat avatar Jun 11 '23 07:06 wahabmangat