@@ -11,6 +11,19 @@ class Options
1111 private \Spameri \ElasticQuery \Options \SortCollection $ sort ;
1212
1313
14+ /**
15+ * @param array<int|string, mixed>|null $searchAfter
16+ * @param array<int, string>|null $storedFields
17+ * @param array<int, string>|null $docvalueFields
18+ * @param array<int, array<string, mixed>>|null $fields
19+ * @param array<string, array<string, mixed>>|null $scriptFields
20+ * @param array<string, mixed>|null $runtimeMappings
21+ * @param array<int, \Spameri\ElasticQuery\Options\Suggest\SuggesterInterface>|null $suggesters
22+ * @param array<int, \Spameri\ElasticQuery\Options\Rescore>|null $rescore
23+ * @param array<int, array<string, float>>|null $indicesBoost
24+ * @param array<int, string>|null $stats
25+ * @param array<string, mixed>|null $ext
26+ */
1427 public function __construct (
1528 private int |null $ size = null ,
1629 private int |null $ from = null ,
@@ -19,6 +32,28 @@ public function __construct(
1932 private bool $ includeVersion = false ,
2033 private string |null $ scroll = null ,
2134 private string |null $ scrollId = null ,
35+ private \Spameri \ElasticQuery \Options \Source |null $ source = null ,
36+ private bool |int |null $ trackTotalHits = null ,
37+ private bool |null $ trackScores = null ,
38+ private bool |null $ explain = null ,
39+ private int |null $ terminateAfter = null ,
40+ private string |null $ timeout = null ,
41+ private array |null $ searchAfter = null ,
42+ private \Spameri \ElasticQuery \Options \Pit |null $ pit = null ,
43+ private array |null $ storedFields = null ,
44+ private array |null $ docvalueFields = null ,
45+ private array |null $ fields = null ,
46+ private array |null $ scriptFields = null ,
47+ private array |null $ runtimeMappings = null ,
48+ private bool |null $ seqNoPrimaryTerm = null ,
49+ private array |null $ indicesBoost = null ,
50+ private \Spameri \ElasticQuery \Options \Collapse |null $ collapse = null ,
51+ private array |null $ rescore = null ,
52+ private array |null $ suggesters = null ,
53+ private string |null $ suggestText = null ,
54+ private bool |null $ profile = null ,
55+ private array |null $ stats = null ,
56+ private array |null $ ext = null ,
2257 )
2358 {
2459 $ this ->sort = $ sort ?: new \Spameri \ElasticQuery \Options \SortCollection ();
@@ -71,6 +106,39 @@ public function scrollInitialized(
71106 }
72107
73108
109+ public function collapse (): \Spameri \ElasticQuery \Options \Collapse |null
110+ {
111+ return $ this ->collapse ;
112+ }
113+
114+
115+ /**
116+ * @return array<int, \Spameri\ElasticQuery\Options\Rescore>|null
117+ */
118+ public function rescore (): array |null
119+ {
120+ return $ this ->rescore ;
121+ }
122+
123+
124+ /**
125+ * @return array<int, \Spameri\ElasticQuery\Options\Suggest\SuggesterInterface>|null
126+ */
127+ public function suggesters (): array |null
128+ {
129+ return $ this ->suggesters ;
130+ }
131+
132+
133+ public function suggestText (): string |null
134+ {
135+ return $ this ->suggestText ;
136+ }
137+
138+
139+ /**
140+ * @return array<string, mixed>
141+ */
74142 public function toArray (): array
75143 {
76144 $ array = [];
@@ -92,7 +160,7 @@ public function toArray(): array
92160 $ array ['sort ' ][] = $ item ->toArray ();
93161 }
94162
95- if ($ this ->minScore ) {
163+ if ($ this ->minScore !== null ) {
96164 $ array ['min_score ' ] = $ this ->minScore ;
97165 }
98166
@@ -105,6 +173,78 @@ public function toArray(): array
105173 $ array ['scroll ' ] = $ this ->scroll ;
106174 }
107175
176+ if ($ this ->source !== null ) {
177+ $ array ['_source ' ] = $ this ->source ->value ();
178+ }
179+
180+ if ($ this ->trackTotalHits !== null ) {
181+ $ array ['track_total_hits ' ] = $ this ->trackTotalHits ;
182+ }
183+
184+ if ($ this ->trackScores !== null ) {
185+ $ array ['track_scores ' ] = $ this ->trackScores ;
186+ }
187+
188+ if ($ this ->explain !== null ) {
189+ $ array ['explain ' ] = $ this ->explain ;
190+ }
191+
192+ if ($ this ->terminateAfter !== null ) {
193+ $ array ['terminate_after ' ] = $ this ->terminateAfter ;
194+ }
195+
196+ if ($ this ->timeout !== null ) {
197+ $ array ['timeout ' ] = $ this ->timeout ;
198+ }
199+
200+ if ($ this ->searchAfter !== null ) {
201+ $ array ['search_after ' ] = $ this ->searchAfter ;
202+ }
203+
204+ if ($ this ->pit !== null ) {
205+ $ array ['pit ' ] = $ this ->pit ->toArray ();
206+ }
207+
208+ if ($ this ->storedFields !== null ) {
209+ $ array ['stored_fields ' ] = $ this ->storedFields ;
210+ }
211+
212+ if ($ this ->docvalueFields !== null ) {
213+ $ array ['docvalue_fields ' ] = $ this ->docvalueFields ;
214+ }
215+
216+ if ($ this ->fields !== null ) {
217+ $ array ['fields ' ] = $ this ->fields ;
218+ }
219+
220+ if ($ this ->scriptFields !== null ) {
221+ $ array ['script_fields ' ] = $ this ->scriptFields ;
222+ }
223+
224+ if ($ this ->runtimeMappings !== null ) {
225+ $ array ['runtime_mappings ' ] = $ this ->runtimeMappings ;
226+ }
227+
228+ if ($ this ->seqNoPrimaryTerm !== null ) {
229+ $ array ['seq_no_primary_term ' ] = $ this ->seqNoPrimaryTerm ;
230+ }
231+
232+ if ($ this ->indicesBoost !== null ) {
233+ $ array ['indices_boost ' ] = $ this ->indicesBoost ;
234+ }
235+
236+ if ($ this ->profile !== null ) {
237+ $ array ['profile ' ] = $ this ->profile ;
238+ }
239+
240+ if ($ this ->stats !== null ) {
241+ $ array ['stats ' ] = $ this ->stats ;
242+ }
243+
244+ if ($ this ->ext !== null ) {
245+ $ array ['ext ' ] = $ this ->ext ;
246+ }
247+
108248 return $ array ;
109249 }
110250
0 commit comments