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

Multiple documents for the same ActiveRecord object #283

Open
jcn opened this issue Sep 11, 2023 · 1 comment
Open

Multiple documents for the same ActiveRecord object #283

jcn opened this issue Sep 11, 2023 · 1 comment

Comments

@jcn
Copy link

jcn commented Sep 11, 2023

Since we do not have the ability to do multi-geo points in the same document (meilisearch/product#508), I've been thinking about possibly indexing the same object multiple times using a different _geo for each one and then using a distinctAttribute to to only show a single document (in this case a user with multiple addresses) in the result set.

My question is, is there a recommended approach to doing this with meilisearch-rails or would the better option in this case to completely ignore this gem and just use the native Ruby gem and write our own code around the indexing and querying? It seems a shame to ignore all the additional features that are provided by the rails gem (the search method returning AR objects, pagy integration, etc), but I can't see a natural way to have a single ActiveRecord object index itself in multiple ways.

Any advice would be wonderful.

@ellnix
Copy link
Collaborator

ellnix commented Sep 27, 2023

There is nothing that I can see intended for this particular use case, though maybe there could be. But first, I would like to know can a user have any number of addresses or are they limited to a fixed number?

I am assuming there are multiple fields in the users table and not a has_many to another table?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants