File tree 3 files changed +10
-9
lines changed
3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public function rewind()
45
45
46
46
// initial scan request
47
47
$ this ->_search ->getQuery ()->setSize ($ this ->sizePerShard );
48
- $ this ->_search ->setOption (Search::OPTION_SCROLL , $ this ->expiryTime );
48
+ $ this ->_search ->setOption (Search::OPTION_SCROLL , $ this ->_expiryTime );
49
49
$ this ->_search ->setOption (Search::OPTION_SCROLL_ID , null );
50
50
$ this ->_search ->setOption (Search::OPTION_SEARCH_TYPE , Search::OPTION_SEARCH_TYPE_SCAN );
51
51
$ this ->_setScrollId ($ this ->_search ->search ());
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ class Scroll implements \Iterator
49
49
public function __construct (Search $ search , $ expiryTime = '1m ' )
50
50
{
51
51
$ this ->_search = $ search ;
52
- $ this ->expiryTime = $ expiryTime ;
52
+ $ this ->_expiryTime = $ expiryTime ;
53
53
}
54
54
55
55
/**
@@ -73,7 +73,7 @@ public function next()
73
73
{
74
74
$ this ->_saveOptions ();
75
75
76
- $ this ->_search ->setOption (Search::OPTION_SCROLL , $ this ->expiryTime );
76
+ $ this ->_search ->setOption (Search::OPTION_SCROLL , $ this ->_expiryTime );
77
77
$ this ->_search ->setOption (Search::OPTION_SCROLL_ID , $ this ->_nextScrollId );
78
78
$ this ->_search ->setOption (Search::OPTION_SEARCH_TYPE , Search::OPTION_SEARCH_TYPE_SCROLL );
79
79
$ this ->_setScrollId ($ this ->_search ->search ());
@@ -122,7 +122,7 @@ public function rewind()
122
122
// initial search
123
123
$ this ->_saveOptions ();
124
124
125
- $ this ->_search ->setOption (Search::OPTION_SCROLL , $ this ->expiryTime );
125
+ $ this ->_search ->setOption (Search::OPTION_SCROLL , $ this ->_expiryTime );
126
126
$ this ->_search ->setOption (Search::OPTION_SCROLL_ID , null );
127
127
$ this ->_search ->setOption (Search::OPTION_SEARCH_TYPE , null );
128
128
$ this ->_setScrollId ($ this ->_search ->search ());
Original file line number Diff line number Diff line change @@ -22,23 +22,24 @@ public function testForeach()
22
22
foreach ($ scroll as $ scrollId => $ resultSet ) {
23
23
$ this ->assertNotEmpty ($ scrollId );
24
24
25
+ $ results = $ resultSet ->getResults ();
25
26
switch (true ) {
26
27
case $ count === 1 :
27
28
// hits: 1 - 5
28
29
$ 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 ());
31
32
break ;
32
33
case $ count === 2 :
33
34
// hits: 6 - 10
34
35
$ 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 ());
37
38
break ;
38
39
case $ count === 3 :
39
40
// hit: 11
40
41
$ this ->assertEquals (1 , $ resultSet ->count ());
41
- $ this ->assertEquals ('11 ' , $ resultSet -> getResults () [0 ]->getId ());
42
+ $ this ->assertEquals ('11 ' , $ results [0 ]->getId ());
42
43
break ;
43
44
case $ count === 4 :
44
45
$ this ->assertEquals (0 , $ resultSet ->count ());
You can’t perform that action at this time.
0 commit comments