pimcore / ecommerce-framework-bundle

Ecommerce Framework community bundle provides e-commerce functionality such as product listing and filtering, pricing, carts and checkouts for Pimcore.
https://pimcore.com/docs/platform/Ecommerce_Framework/
Other
8 stars 28 forks source link

Fix LIMIT_UNLIMITED type issue #140

Closed bckpff closed 8 months ago

bckpff commented 8 months ago

This fixes a type issue with the \Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\ProductList\ElasticSearch\AbstractElasticSearch::LIMIT_UNLIMITED constant.

The external setter for the limit only accepts integer values thus preventing the use of the elastic scroll api and limiting result sets to 10.000 (default configuration) or the value max_result_window.

I have read the CLA Document and I hereby sign the CLA

kingjia90 commented 8 months ago

Could you please rebase the branch to 1.0 as this should go into a bug fix release? TIA

kingjia90 commented 8 months ago

Having some doubts on a bigger picture:

bckpff commented 8 months ago

was unlimited intentionally introduced to have a different behavior from -1 WITHOUT this scroll request?

I don't see the use case for that. Elasticsearch discourages fetching result sets with size (+ offset) > max_result_window and explicitly states to use the scroll API (or better the search_after method: https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after)

Maybe add a setter and getter for the doScrollRequest Property?

github-actions[bot] commented 8 months ago

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

fashxp commented 8 months ago

@kingjia90 I think proposed solution is fine and should not do any harm.

@bckpff could you please once more add a comment to sign the CLA ... not sure if it works already in PR description. thank you very much.

bckpff commented 8 months ago

I have read the CLA Document and I hereby sign the CLA

kingjia90 commented 8 months ago

@kingjia90 I think proposed solution is fine and should not do any harm.

There's a potential bc-break in the native parameter type, if they passed unlimited as string is going to crash, we never deprecated it nor mentioned in the upgrade notes, it's more to consider that the PHPDoc (only int) was wrong.

Probably could refactor by removing the constant, and just stick with if ($limit > 0) or so to keep it simpler.

fashxp commented 8 months ago

@kingjia90 I think proposed solution is fine and should not do any harm.

There's a potential bc-break in the native parameter type, if they passed unlimited as string is going to crash, we never deprecated it nor mentioned in the upgrade notes, it's more to consider that the PHPDoc (only int) was wrong.

Probably could refactor by removing the constant, and just stick with if ($limit > 0) or so to keep it simpler.

But that bc break already happened with Pimcore 11.0 right? So in Pimcore 11 it never worked so far (neither with the constant nor with a custom string). And we're fixing it now at least for the case when you used the constant.

kingjia90 commented 8 months ago

ah ok, got it, then merging soon