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

Fix solr query types #50

Merged
merged 4 commits into from
Oct 26, 2023
Merged

Fix solr query types #50

merged 4 commits into from
Oct 26, 2023

Conversation

bix0r
Copy link
Collaborator

@bix0r bix0r commented Feb 15, 2023

Fix for issue #37, attempt 3.

Previous: PR #38.

This time I manage to skip all BC problems, allowing both strings and integers.

Some methods that should be excepting an int are forcing their argument
as string.
Methods: 'setStart', 'setRows' and 'setExpandRows', 'setTimeAllowed' and 'setGroupOffset'.
Instead of forcing the argument to be correct (as an int), we keep BC by
allowing strings, but we throw an exception if argument is neither.
@bix0r
Copy link
Collaborator Author

bix0r commented Feb 15, 2023

@Ingimarsson Here is the new attempt at the type fix.

@Ingimarsson
Copy link
Contributor

@bix0r I compiled it on my machine and did some tests. Looks good.

I think it might be better to use the macros ZEND_PARSE_PARAMETERS_* to read parameters... although then it would be inconsistent with the rest of the code base.

@bix0r
Copy link
Collaborator Author

bix0r commented Feb 23, 2023

@Ingimarsson I wanted to use the new ZPP, but the macro we need in this case is Z_PARAM_STR_OR_LONG and that was only added in php-8.0.

@omars44
Copy link
Collaborator

omars44 commented Jul 13, 2023

@bix0r Welcome :)

I do think that the code base has too much legacy that has to do more with PHP5 > PHP7 compat, and now PHP 8.0 is reaching EOL, so I don't really think we should support any older versions than the active cycle of the PHP core, as this is an extension by definition. So 8.0 should be the oldest version to support IMHO.

I'm thinking about a major refactor, to get rid of all the legacy code that had to with the switch, and to have less things to worry about, especially BC of 5 is not really wise to think about even 7. Another topic would be to modernize the codebase, for the issue at hand, I think we should support the new macros, delegating the handling of method args to the Zend Engine would do us a great favor in terms of future support and stability.

So yea, if you would be interested to e-meet sometime next week to discuss the next steps, you're welcome to get in touch via email.

Best,
Omar

@bix0r
Copy link
Collaborator Author

bix0r commented Jul 13, 2023

Hi @omars44, nice to see you back here :)

I agree that we should freshen up the code base quite a bit, and I am interested in having an e-meet next week. I will email you.

However, I would love to get this fix into master and release a version with it, with all this backwards compatibility. Just so we leave that part in a bit better state (I know many still are using 7.x and some are still supporting it). That should be pretty simple and I think this PR should be ready to be merged.

@Jan-E
Copy link
Contributor

Jan-E commented Jul 14, 2023

I agree with @bix0r : let us have a final PHP 7 release (with this PR merged) before skipping support for 7.x.

@omars44
Copy link
Collaborator

omars44 commented Oct 7, 2023

@bix0r I believe these 2 signatures need the same parameter fixes:

public  **SolrDisMaxQuery::setPhraseSlop**(string  `$slop`): [SolrDisMaxQuery](https://www.php.net/manual/en/class.solrdismaxquery.php)

public  **SolrCollapseFunction::setSize**(int  `$size`):  [SolrCollapseFunction](https://www.php.net/manual/en/class.solrcollapsefunction.php)

Related to the last commit.
Now fixing types for:
SolrCollapseFunction::setSize()
SolrDisMaxQuery::setPhraseSlop()
SolrDisMaxQuery::setQueryPhraseSlop()
SolrDisMaxQuery::setBigramPhraseSlop()
SolrDisMaxQuery::setTrigramPhraseSlop()
@bix0r bix0r force-pushed the fix-solrQuery-types-v3 branch from 5323960 to 4d8668d Compare October 13, 2023 13:35
@bix0r
Copy link
Collaborator Author

bix0r commented Oct 13, 2023

@omars44 I found few more methods:

  • SolrDisMaxQuery::setQueryPhraseSlop()
  • SolrDisMaxQuery::setBigramPhraseSlop()
  • SolrDisMaxQuery::setTrigramPhraseSlop()

I've fixed all 5 of them.

@omars44
Copy link
Collaborator

omars44 commented Oct 24, 2023

@bix0r looks good, can u rebase master and add to NEWS the changelog entry

@bix0r
Copy link
Collaborator Author

bix0r commented Oct 24, 2023

@omars44 Perhaps you want to merge the optimize PR before I rebase?

@omars44
Copy link
Collaborator

omars44 commented Oct 25, 2023

@bix0r done, thanks

@bix0r bix0r force-pushed the fix-solrQuery-types-v3 branch from 4d8668d to fcfa3d1 Compare October 25, 2023 09:06
@bix0r
Copy link
Collaborator Author

bix0r commented Oct 25, 2023

@omars44 Rebased and NEWS updated

@omars44 omars44 merged commit 9b1fc2d into php:master Oct 26, 2023
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

Successfully merging this pull request may close these issues.

4 participants