Skip to content

Commit

Permalink
Fix LIMIT_UNLIMITED type issue (#140)
Browse files Browse the repository at this point in the history
* Fix LIMIT_UNLIMITED type issue

* Update PHPDoc

* update phpdoc comment

---------

Co-authored-by: Florian Tinney <florian.tinney@elbkapitaene.de>
Co-authored-by: JiaJia Ji <kingjia90@gmail.com>
  • Loading branch information
3 people authored Nov 27, 2023
1 parent 2ba06e8 commit ef898cf
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

abstract class AbstractElasticSearch implements ProductListInterface
{
const LIMIT_UNLIMITED = 'unlimited';
const LIMIT_UNLIMITED = -1;

const INTEGER_MAX_VALUE = 2147483647; // Elasticsearch Integer.MAX_VALUE is 2^31-1

Expand Down Expand Up @@ -321,19 +321,19 @@ public function getOrderKey(): array|string
}

/**
* Pass "unlimited" to do da Scroll Request
* Pass -1 to enable the unlimited scroll request
*
* @param int $limit
*
* @return void
*/
public function setLimit(int $limit): void
{
if ($this->limit != $limit) {
if ($this->limit !== $limit) {
$this->products = null;
}

if ($limit == static::LIMIT_UNLIMITED) {
if ($limit === static::LIMIT_UNLIMITED) {
$this->limit = 100;
$this->doScrollRequest = true;
} else {
Expand Down

0 comments on commit ef898cf

Please sign in to comment.