Closed brunoocasali closed 8 months ago
Should this not first be added to meilisearch-ruby? I checked, but there was no issue for it, past or present.
The multi_search
works on ruby already :)
https://github.com/meilisearch/meilisearch-ruby/issues/489#issuecomment-1750645773
No problem
Any updates on this? I am now adding multi-search to my app, so this would be really helpful with integration
Same here, Would really like to add this to my app.
Meili team will not have the time to work on it, sorry. We are a really small team so we have to prioritize our tasks. However any contributions are welcome and we will be ready to review them 😊
I tried to do this but didnt reach far.
@curquiza Would you be open to bounties?.
Created bounty on algora but i think you will have to add app and accept or something : https://console.algora.io/bounties/clsd5ih5e0006jy0fja0imiu0
I can probably do this, but it will take some reengineering with the current code base, and we should probably discuss API since there is nothing like it currently in the gem.
The primary challenge is matching index names to models, which we reasonably cannot do and therefore will be passed on as a responsibility to the user.
Currently I can think of:
search
with an in-between array-like class so we can add method chaining like ActiveRecord Relation. Think Product.search('thing').and(Book.search('paper'))
.
A separate multi-search method
Model-centric
MeiliSearch::Rails.multi_search(
Book => {q: 'paper', **book_options}, # Model with implied index
Product => {q: 'thing', **product_options},
**other_searches)
Index-centric
MeiliSearch::Rails.multi_search(
'book_production' => {q: 'paper', class_name: 'Book', **book_options}, # Index with a model
'stuff_production' => {q: 'thing', class_name: 'Product', **product_options},
'blurbs' => { q: 'happy' }, # Index not backed by a model, results will be simple hashes
**other_searches)
Polymorphic (both model-centric and index-centric)
MeiliSearch::Rails.multi_search(
'book_production' => {q: 'paper', class_name: 'Book', **book_options}, # Index with a model
Product => {q: 'thing', **product_options}, # Model with implied index
'blurbs' => { q: 'happy' }, # Index not backed by a model, results will be simple hashes
**other_searches)
Personally I prefer 2. iii.
the polymorphic dedicated method, despite how messy it looks in the example above, it would allow for the most options and flexibility. I am open to other suggestions and will also add any others I can think of.
@curquiza Would you be open to bounties?.
No, we don't have a bounty for opensource contributions
Thank you @ellnix let know now if you need review on anything. I talked with Bruno and we will try to be reactive on this
Created bounty on algora but i think you will have to add app and accept or something : https://console.algora.io/bounties/clsd5ih5e0006jy0fja0imiu0
hey algora cofounder here :wave: meilisearch team can accept the bounty here if they'd like! https://algora.io/invitation/meilisearch
Just checking to make sure,
If I have two models, Question and Reply, then to search both of them at once, do I need this feature? Is there any other way of doing it that I don't know about?
I'm curious because it seems like a common use case for a search product.
If I have two models, Question and Reply, then to search both of them at once, do I need this feature? Is there any other way of doing it that I don't know about?
Well not necessarily:
multi_search
directly on MeiliSearch::Rails.client
(not recommended)Making "Questions and Replies share an index and search that index" could works for me.
Let me try, Thanks.
Thank you for merging this, can you share some pointers on using it?
MeiliSearch::Rails.multi_search
is giving undefined method.
Thank you for merging this, can you share some pointers on using it?
MeiliSearch::Rails.multi_search
is giving undefined method.
It has just been implemented, it will be made available in the next release. I will also make a PR to add usage to the README.
⚠️ This issue is generated, it means the examples and the namings do not necessarily correspond to the language of this repository. Also, if you are a maintainer, feel free to add any clarification and instruction about this issue.
Sorry if this is already partially/completely implemented, feel free to let me know about the state of this issue in the repo.
Related to https://github.com/meilisearch/integration-guides/issues/251
Related to:
Create a new client method called
multiSearch
/multi_search
, which will requestPOST /multi-search
with a body payload containing a structure similar to this:Each object is a simple search object sent in the
POST /indexes/:indexUid/search
request.Pay attention to the response, which will follow the order of the requests object and will look like this (note the new
indexUid
key in the response):TODO:
multi_search
method