Skip to content

Commit d89fffa

Browse files
committed
Sort methods
1 parent 4726586 commit d89fffa

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/Factories/SearchRequestFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,17 @@ protected function applyOptions(OpenSearchRequest $request, array $options): voi
126126
$request->source($options['_source']);
127127
}
128128

129+
if (array_key_exists('search_after', $options)) {
130+
$request->searchAfter($options['search_after']);
131+
}
132+
129133
if (array_key_exists('track_scores', $options)) {
130134
$request->trackScores($options['track_scores']);
131135
}
132136

133137
if (array_key_exists('track_total_hits', $options)) {
134138
$request->trackTotalHits($options['track_total_hits']);
135139
}
136-
137-
if (array_key_exists('search_after', $options)) {
138-
$request->searchAfter($options['search_after']);
139-
}
140140
}
141141

142142
/**

src/SearchRequestPayload.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ public function query(): array
5353
return $this->query;
5454
}
5555

56+
/**
57+
* Get the maximum number of results.
58+
*/
59+
public function size(): ?int
60+
{
61+
return $this->size;
62+
}
63+
5664
/**
5765
* Get the sort definitions.
5866
*
@@ -81,14 +89,6 @@ public function searchAfter(): ?array
8189
return $this->searchAfter;
8290
}
8391

84-
/**
85-
* Get the maximum number of results.
86-
*/
87-
public function size(): ?int
88-
{
89-
return $this->size;
90-
}
91-
9292
/**
9393
* Get the aggregation definitions.
9494
*

0 commit comments

Comments
 (0)