Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a scope parameter to eager load matched records #233

Open
DavertMik opened this issue Jan 10, 2023 · 1 comment
Open

Add a scope parameter to eager load matched records #233

DavertMik opened this issue Jan 10, 2023 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@DavertMik
Copy link

Description
It would be nice if this gem could to eager load relations of matched records

class Book
  scope with_author: -> { includes(:author) }
end

Book.search('Harry Potter', scope: :with_author)

I would add an optional scope parameter and used it here to load relations
https://github.com/meilisearch/meilisearch-rails/blob/main/lib/meilisearch-rails.rb#L653

@brunoocasali brunoocasali added the enhancement New feature or request label Feb 22, 2023
@brunoocasali
Copy link
Member

Hi @DavertMik sorry for the late reply. Indeed it would be a nice addition, I go further if we had something like this:

Book.with_author.with_reviews.search('Harry Potter')

@brunoocasali brunoocasali added the good first issue Good for newcomers label Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants