I may be misunderstanding this, but I wanted to double check.
We have a multi tenant situation. We have index names dynamically set, but we need to have dynamic scopes. From what I'm seeing, index_scope is run once, but then "cached" for subsequent runs.
Example:
DocumentIndex < Chewy::Index
index_scope Document.where(license_ids: Tenant.current.license_ids)
end
Apartment.tenant_names.each do |tenant|
DocumentIndex.sync
end
What we end up seeing, is the first sync in the loop has the correct license_ids, but every subsequent query is a cached version of the first query.
Is there a way to ensure in this case that the query is called with the appropriate scope?
Thanks!
I may be misunderstanding this, but I wanted to double check.
We have a multi tenant situation. We have index names dynamically set, but we need to have dynamic scopes. From what I'm seeing,
index_scopeis run once, but then "cached" for subsequent runs.Example:
What we end up seeing, is the first sync in the loop has the correct license_ids, but every subsequent query is a cached version of the first query.
Is there a way to ensure in this case that the query is called with the appropriate scope?
Thanks!