Skip to content

Commit cfcd3a5

Browse files
committed
fixed naming bug + PHP 5.3 issue
1 parent 55999d8 commit cfcd3a5

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

lib/Elastica/ScanAndScroll.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function rewind()
4545

4646
// initial scan request
4747
$this->_search->getQuery()->setSize($this->sizePerShard);
48-
$this->_search->setOption(Search::OPTION_SCROLL, $this->expiryTime);
48+
$this->_search->setOption(Search::OPTION_SCROLL, $this->_expiryTime);
4949
$this->_search->setOption(Search::OPTION_SCROLL_ID, null);
5050
$this->_search->setOption(Search::OPTION_SEARCH_TYPE, Search::OPTION_SEARCH_TYPE_SCAN);
5151
$this->_setScrollId($this->_search->search());

lib/Elastica/Scroll.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Scroll implements \Iterator
4949
public function __construct(Search $search, $expiryTime = '1m')
5050
{
5151
$this->_search = $search;
52-
$this->expiryTime = $expiryTime;
52+
$this->_expiryTime = $expiryTime;
5353
}
5454

5555
/**
@@ -73,7 +73,7 @@ public function next()
7373
{
7474
$this->_saveOptions();
7575

76-
$this->_search->setOption(Search::OPTION_SCROLL, $this->expiryTime);
76+
$this->_search->setOption(Search::OPTION_SCROLL, $this->_expiryTime);
7777
$this->_search->setOption(Search::OPTION_SCROLL_ID, $this->_nextScrollId);
7878
$this->_search->setOption(Search::OPTION_SEARCH_TYPE, Search::OPTION_SEARCH_TYPE_SCROLL);
7979
$this->_setScrollId($this->_search->search());
@@ -122,7 +122,7 @@ public function rewind()
122122
// initial search
123123
$this->_saveOptions();
124124

125-
$this->_search->setOption(Search::OPTION_SCROLL, $this->expiryTime);
125+
$this->_search->setOption(Search::OPTION_SCROLL, $this->_expiryTime);
126126
$this->_search->setOption(Search::OPTION_SCROLL_ID, null);
127127
$this->_search->setOption(Search::OPTION_SEARCH_TYPE, null);
128128
$this->_setScrollId($this->_search->search());

test/lib/Elastica/Test/ScrollTest.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,24 @@ public function testForeach()
2222
foreach ($scroll as $scrollId => $resultSet) {
2323
$this->assertNotEmpty($scrollId);
2424

25+
$results = $resultSet->getResults();
2526
switch (true) {
2627
case $count === 1:
2728
// hits: 1 - 5
2829
$this->assertEquals(5, $resultSet->count());
29-
$this->assertEquals('1', $resultSet->getResults()[0]->getId());
30-
$this->assertEquals('5', $resultSet->getResults()[4]->getId());
30+
$this->assertEquals('1', $results[0]->getId());
31+
$this->assertEquals('5', $results[4]->getId());
3132
break;
3233
case $count === 2:
3334
// hits: 6 - 10
3435
$this->assertEquals(5, $resultSet->count());
35-
$this->assertEquals('6', $resultSet->getResults()[0]->getId());
36-
$this->assertEquals('10', $resultSet->getResults()[4]->getId());
36+
$this->assertEquals('6', $results[0]->getId());
37+
$this->assertEquals('10', $results[4]->getId());
3738
break;
3839
case $count === 3:
3940
// hit: 11
4041
$this->assertEquals(1, $resultSet->count());
41-
$this->assertEquals('11', $resultSet->getResults()[0]->getId());
42+
$this->assertEquals('11', $results[0]->getId());
4243
break;
4344
case $count === 4:
4445
$this->assertEquals(0, $resultSet->count());

0 commit comments

Comments
 (0)