-
Notifications
You must be signed in to change notification settings - Fork 98
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
Indexes::search() improvements #120
Conversation
823beb5
to
4de3173
Compare
Hello @Guikingone! So sorry for the delay!!! |
71be79a
to
751e9b1
Compare
751e9b1
to
16ae9b0
Compare
Hello @curquiza 👋 The checks are green after a small refactoring, feel free to review it when you have time, I've introduced the |
Thank you so much @Guikingone! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me. Real nice touch with the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this huge job, I just ask for small modifications!
About your question, yes let it as it is for the moment, it seems ok for me 🙂
Again, thank you so much for your work 🙏 Be sure we are going to extend this way of handling search result to our other SDKs.
FYI: I'm not going to release right after merging this PR. I indeed need to discuss naming with my team, and most of all, another breaking PR is planned so I will do the push to Packagist after all the breaking changes are done 😇
src/Endpoints/Indexes.php
Outdated
if (\array_key_exists('filteringHits', $options) && \is_callable($options['filteringHits'])) { | ||
$searchResult = $searchResult->filter($options['filteringHits']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (\array_key_exists('filteringHits', $options) && \is_callable($options['filteringHits'])) { | |
$searchResult = $searchResult->filter($options['filteringHits']); | |
if (\array_key_exists('transformHits', $options) && \is_callable($options['transformHits'])) { | |
$searchResult = $searchResult->filter($options['transformHits']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is "filtering" in PHP because we use the filter
method. However, in the case of MeiliSearch, I'm afraid the users are confused with the filtering of MeiliSearch -> https://docs.meilisearch.com/guides/advanced_guides/filtering.html#filtering
That's why I suggest this name. Not sure this is the best, but we'll probably change it once all my team will come back from holidays and we can discuss the new naming 🙂 (I'm not going to push the package to Packagist before of course)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improved 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally merging! Thanks a lot @Guikingone and also @ppshobi! 🎉
bors merge
Hi everyone 👋
As mentioned here: #119, here's the
SearchResult
class and the improvements that comes with it.There's just a small "DX" way that I'm not sure about:
SearchResult::filter()
should thehits
array be reset to 0 or stay as it?IMO, the array could stays as it as we return a new
SearchResult
object but sometimes, it could be good idea to reset the keys from 0 (loops, etc) 🤔Thanks for the feedback and have a great day 🙂