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

Backport MatchQuery into 6.x branch #1879

Closed
reedy opened this issue Nov 30, 2020 · 8 comments
Closed

Backport MatchQuery into 6.x branch #1879

reedy opened this issue Nov 30, 2020 · 8 comments

Comments

@reedy
Copy link
Contributor

reedy commented Nov 30, 2020

Related to #1799 and #1793

While it's not so important that the 6.x branch supports PHP 8.0 (at least for us, for other people it might be), it'd be useful if MatchQuery in some form or another is backported into the 6.x branch, allowing code that needs to support 6.x | 7.x is able to set a version constraint to bring in the newer version of 6.x (ie 6.2 onwards or similar), and have the MatchQuery class available for both branches, to ease later migration burdens, and also not having to support both Match and MatchQuery in extends and use clauses etc.

In the simplest form, I guess a class_alias or class MatchQuery extends Match {} would do it. But for ease, it might be "easier" to backport all of #1799 to keep any subsequent backports and such easier (if they happen to touch the same code).

@ruflin
Copy link
Owner

ruflin commented Dec 1, 2020

++ on making the migration easier. I would prefer to have the change as lightweight as possible on the 6.x branch. I'm worried that we might break something by accident and then need to have more maintenance on the 6.x branch. So if the "extends" approach works this would be my preference, but happy to be convinced otherwise.

For the backports: I'm hopping we have very few / none of these to 6.x but I'm sure reality will proof me wrong.

@reedy
Copy link
Contributor Author

reedy commented Dec 1, 2020

I believe it should be enough. As long as it's in the same tree (so something like class MatchQuery extends Match {}), we all know PHP isn't overly strict on many things.

So that will allow people for migration to replace Match with MatchQuery (just needing to bump their 6.x requirement to effectively be >= the next 6.x release). Then when they switch to/allow 7 (and similarly, set >= the next 7.x release), this "migration" is done. Obviously other changes might be needed for other things, but that's fine.

As above, it's not so much for PHP 8.0 support via Elastica 6.x (though if that's possible, maybe it's beneficial; in that case MatchQuery extends Match might not actually work on PHP 8 as it wouldn't be valid syntax. The way you've done it in 7.x in theory should be fine as the Match extends MatchQuery shouldn't really be executed unless someone triggers the autoloading), it's more so that potentially both 6.x and 7.x can be supported without having to put conditionals on the class they need to use Match/MatchQuery

I guess in part, it all depends what https://github.com/elastic/elasticsearch-php end up doing in terms of PHP 8 support in their branches. https://github.com/elastic/elasticsearch-php#php-version-requirement says for 6.0 >= 7.0.0, and 7.0 >= 7.1.0; but >= isn't semver, so technically means PHP 8.0 for both. In composer.json, for 6.0 it's ^7.0 and 7.0 it's ^7.1. which obviously doesn't include PHP 8.0. I've filed elastic/elasticsearch-php#1083 for the table clarifying.

I think we should be able to publish a new 7.1.0 version in the coming days, but it would be better to wait for the elasticsearch official library to be officially compatible with PHP 8.0 before publishing the 7.1.0.

I've also just filed elastic/elasticsearch-php#1084 asking for which version(s) are going to support PHP 8.0, to help answer #1799 (comment)

reedy added a commit to reedy/Elastica that referenced this issue Feb 11, 2021
@reedy
Copy link
Contributor Author

reedy commented Feb 11, 2021

PR up... :)

@reedy
Copy link
Contributor Author

reedy commented Feb 11, 2021

If we can get a release after that PR is merged, that'd be appreciated!

Changes on the 6.x branch: 6.1.1...6.x

deguif pushed a commit that referenced this issue Feb 15, 2021
* Add MatchQuery class for forward compat

Fixes #1879

* CHANGELOG: Add entry for addition of `Elastica\Query\MatchQuery`
@deguif
Copy link
Collaborator

deguif commented Feb 15, 2021

It was merged.

@deguif deguif closed this as completed Feb 15, 2021
@reedy
Copy link
Contributor Author

reedy commented Feb 15, 2021

Thanks!

Should I file a seperate task about a new 6.x release? 6.1.2, presumably? 6.1.1...6.x

@reedy
Copy link
Contributor Author

reedy commented Feb 15, 2021

Oh, duh. Just saw #1901

👍

@deguif
Copy link
Collaborator

deguif commented Feb 16, 2021

Version 6.1.2 was just released.

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

3 participants