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

Refactor for SOLID compliance - Breaking on getAllIndexes (method return) and Index class (renamed into Indexes) #43

Conversation

ppshobi
Copy link
Contributor

@ppshobi ppshobi commented Jun 18, 2020

No description provided.

@ppshobi ppshobi force-pushed the refactor-to-have-better-SOLID-principles-compliance branch from bbcc440 to 228fe40 Compare June 18, 2020 23:20
@curquiza
Copy link
Member

Hello @ppshobi! Nice to see you again!! 😄
Is this PR ready for review? If it's not, could you convert it as a draft, please? :)

Another question: how does this refactor impact the usage of the package? In other word: what would be the new Getting Started (if there is any changes)? 🙂

@ppshobi
Copy link
Contributor Author

ppshobi commented Jun 19, 2020

The getting started would not change at all. Only the getAllIndexes() methods return will have a change. Since it will be returning an array of Index::class objects instead of array of arrays.

Also by making a release-draft what you mean? change the version number in Meilisearch.php?

Ah, sorry. I think this PR is ready to review. Please take a look

@curquiza
Copy link
Member

Great!! Thanks a lot!
So cool it does not change the docs and the Getting Started!

But it is a breaking change on getAllIndexes -> this is not a problem, we are going to upgrade the minor of the version 😉

I check your PR on Monday @ppshobi! 🙂

@curquiza curquiza changed the title Refactor to have better SOLID principles compliance Refactor to have better SOLID principles compliance (breaking change on getAllIndexes) Jun 19, 2020
@curquiza curquiza changed the title Refactor to have better SOLID principles compliance (breaking change on getAllIndexes) Refactor to have better SOLID principles compliance (breaking on getAllIndexes) Jun 19, 2020
@curquiza curquiza self-requested a review June 19, 2020 16:37
@curquiza curquiza added the breaking-change The related changes are breaking for the users label Jun 19, 2020
@ppshobi ppshobi force-pushed the refactor-to-have-better-SOLID-principles-compliance branch from 5d60220 to 7bcbc94 Compare June 26, 2020 17:04
@ppshobi ppshobi force-pushed the refactor-to-have-better-SOLID-principles-compliance branch from 7bcbc94 to 136b770 Compare June 26, 2020 17:07
@ppshobi
Copy link
Contributor Author

ppshobi commented Jun 26, 2020

Hi @Guikingone , If you can please resolve the conversations as appropriate.

@curquiza The tests are failing due to a recent release from yesterday (25-jun-2020), due to which some endpoints are not returning values as expected. Maybe meiliearch-core have changed the public api, in that case we need to update the tests. Can you confirm the failing tests from the CI logs?

meilisearch/meilisearch#798

@Guikingone
Copy link
Contributor

Hi @ppshobi

For the comments, they're not reviews so I cannot solve them but that's good for me, consider squashing your commits in order to clean the index (except if @curquiza as a special vision on the merged commits 🤔 ) 🙂

@ppshobi
Copy link
Contributor Author

ppshobi commented Jun 27, 2020

@Guikingone usually @curquiza sqaush them while merging. Thanks for your comments

@curquiza
Copy link
Member

curquiza commented Jun 28, 2020

FYI: the tests are currently failing because of:

  • this issue
  • new MeiliSearch bump (from v0.11.0 to v0.11.1) and this PR fixes the tests. The MeiliSearch behavior regarding the settings changed indeed a little bit.

curquiza
curquiza previously approved these changes Jun 30, 2020
@curquiza
Copy link
Member

Hello guys!!


@ppshobi

Thanks again for PR again! I approved it.
Some points:

A question (sorry not to ask it before but I understand better and better each time I read your PR): why do you split the settings in 2 parts? There are:

  • one in the index endpoints Endpoints/Indexes.php
  • another in the delegate Delegates/handlesSearchSettings.php

Why do you use a delegate for the settings? I would say to separate a group of functionality.
So, why do you separate the general settings functionality from the others? 🙂


@Guikingone

Thanks again for your review! I can see you plan to do some changes to this repo 🎉 Feel free to open an issue an start a PR 🙂 Your contribution would be really appreciated!

Also, as you plan to do the symphony integration, here are some useful links:

  • the integration guides repository that basically explains the minimal requirements for a new SDK/Integration. You should take a look at it 😉
  • our Slack. You can contact me directly on it (I'm Clémentine). I recommend you join us, it's more convenient to work together in this kind of project.
  • I've already sent you, but do not forget the already existing laravel-scout package. This package was done and is still mainly maintained by an external contributor 🙂 If you are interested in discussing with him, I will give you his name on our Slack if you join us.

Thanks again guys! A huge work has been done here!

@ppshobi
Copy link
Contributor Author

ppshobi commented Jun 30, 2020

Great. Thank you :)

So regarding those traits. Previously all these methods were together inside the Index class or HttpRequest Class separated by comments. So initially what I have done is creating traits with names related to their functionality and put related methods in them instead of being separated by comments. And I kept methods as it is to avoid any public api changes.

so the methods inside src/Delegates is related to the overall meilisearch engine. For example managing the indexes, getting the stats, getting the version etc.. But the traits inside the Endpoints are related to that sepecific endpoint for example managing a single index, managing the documents inside and index, managing the displayed-attributes of an index etc... actually these methods belongs to Indexes endpoint but I kept them grouped together separately to have better readability instead of bloating the Indexes Endpoint class.

Now it may be better to put them inside another sub directory Eg:src/Endpoints/Delegates/Indexes to indicate that these traits belongs to Indexes class. But I didn't do it since we only have one such big Endpoint class, All other endpoints are contained in themselves.

@curquiza
Copy link
Member

curquiza commented Jul 2, 2020

Hello @ppshobi!
Your PR is finally the next one to be merged! 🙏
Can you rebase please? 😁

@ppshobi
Copy link
Contributor Author

ppshobi commented Jul 3, 2020

Rebasing done. @curquiza can you add a rule to phpcs for using camelCase variables? since all our variables are camelCased and let's prevent new PR's from having snake_cased variables.

@curquiza
Copy link
Member

curquiza commented Jul 3, 2020

Ok, I thought the naming convention for PHP variables was snake_case, but apparently it's not, it depends on what you decided at the beginning 🙂
@ppshobi Can you create an issue to suggest this change?
Thanks for your rebase, I'm doing the last check and then, I will merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The related changes are breaking for the users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants