Description
When searching on a scope, first a a query to meilisearch is made, including the custom or default limit, only returning a small subset of the results. Only after that is the AR scope applied, which in many cases leads to too few or no matches even though there would be many records fulfilling both constraints.
I can understand that this might be hard or impossible to implement properly, but it seems like enough of a gotcha that the docs should explain the limitation. I think one workaround is just setting the limit very high, but of course that has performance implications. I don't know if there is a better solution.
Expected behavior
I expect the limit to be applied to the collection matching both the search and the scope
Current behavior
The limit is applied to a search not considering the scope, leading to way fewer records being returned than would actually match.
Environment
Dont think this is dependent on the environment:
meilisearch (0.32.0)
httparty (~> 0.22)
meilisearch-rails (0.16.0)
meilisearch (~> 0.32.0)
mutex_m (~> 0.2)
Reproduction script:
I think any meiliserach setup would behave in this way, I hope this example is good enough to work with:
User.where(created_at: 1.week.ago..).search('Max')
Meilisearch::Rails.federated_search(queries: [{ q: 'Max', scope: User.where(created_at: 1.week.ago) }])
Description
When searching on a scope, first a a query to meilisearch is made, including the custom or default limit, only returning a small subset of the results. Only after that is the AR scope applied, which in many cases leads to too few or no matches even though there would be many records fulfilling both constraints.
I can understand that this might be hard or impossible to implement properly, but it seems like enough of a gotcha that the docs should explain the limitation. I think one workaround is just setting the limit very high, but of course that has performance implications. I don't know if there is a better solution.
Expected behavior
I expect the limit to be applied to the collection matching both the search and the scope
Current behavior
The limit is applied to a search not considering the scope, leading to way fewer records being returned than would actually match.
Environment
Dont think this is dependent on the environment:
Reproduction script:
I think any meiliserach setup would behave in this way, I hope this example is good enough to work with:
User.where(created_at: 1.week.ago..).search('Max')Meilisearch::Rails.federated_search(queries: [{ q: 'Max', scope: User.where(created_at: 1.week.ago) }])