@@ -26,21 +26,33 @@ class Options
2626 * @var bool
2727 */
2828 private $ includeVersion ;
29+ /**
30+ * @var string|null
31+ */
32+ private $ scroll ;
33+ /**
34+ * @var string|null
35+ */
36+ private $ scrollId ;
2937
3038
3139 public function __construct (
3240 ?int $ size = NULL ,
3341 ?int $ from = NULL ,
3442 ?\Spameri \ElasticQuery \Options \SortCollection $ sort = NULL ,
3543 ?float $ minScore = NULL ,
36- bool $ includeVersion = FALSE
44+ bool $ includeVersion = FALSE ,
45+ ?string $ scroll = NULL ,
46+ ?string $ scrollId = NULL
3747 )
3848 {
3949 $ this ->size = $ size ;
4050 $ this ->from = $ from ;
4151 $ this ->sort = $ sort ?: new \Spameri \ElasticQuery \Options \SortCollection ();
4252 $ this ->minScore = $ minScore ;
4353 $ this ->includeVersion = $ includeVersion ;
54+ $ this ->scroll = $ scroll ;
55+ $ this ->scrollId = $ scrollId ;
4456 }
4557
4658
@@ -56,6 +68,40 @@ public function changeSize(int $size) : void
5668 }
5769
5870
71+ public function sort () : \Spameri \ElasticQuery \Options \SortCollection
72+ {
73+ return $ this ->sort ;
74+ }
75+
76+
77+ public function scroll () : ?string
78+ {
79+ return $ this ->scroll ;
80+ }
81+
82+
83+ public function startScroll (
84+ string $ scroll
85+ ) : void
86+ {
87+ $ this ->scroll = $ scroll ;
88+ }
89+
90+
91+ public function scrollId () : ?string
92+ {
93+ return $ this ->scrollId ;
94+ }
95+
96+
97+ public function scrollInitialized (
98+ string $ scrollId
99+ ) : void
100+ {
101+ $ this ->scrollId = $ scrollId ;
102+ }
103+
104+
59105 public function toArray () : array
60106 {
61107 $ array = [];
@@ -80,13 +126,12 @@ public function toArray() : array
80126 $ array ['version ' ] = $ this ->includeVersion ;
81127 }
82128
83- return $ array ;
84- }
85-
129+ if ($ this ->scrollId !== NULL ) {
130+ $ array ['scroll_id ' ] = $ this ->scrollId ;
131+ $ array ['scroll ' ] = $ this ->scroll ;
132+ }
86133
87- public function sort () : \Spameri \ElasticQuery \Options \SortCollection
88- {
89- return $ this ->sort ;
134+ return $ array ;
90135 }
91136
92137}
0 commit comments