Skip to content

Commit f289330

Browse files
committed
rawSearch has option to return results as is (unsanitized)
1 parent 2d3fedf commit f289330

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/DSL/Bridge.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function processClosePit($id): bool
133133
/**
134134
* @throws Exception
135135
*/
136-
public function processSearchRaw($bodyParams): Results
136+
public function processSearchRaw($bodyParams, $returnRaw): Results
137137
{
138138
$params = [
139139
'index' => $this->index,
@@ -142,6 +142,9 @@ public function processSearchRaw($bodyParams): Results
142142
];
143143
try {
144144
$process = $this->client->search($params);
145+
if ($returnRaw) {
146+
return $this->_return($process, [], $params, $this->_queryTag(__FUNCTION__));
147+
}
145148

146149
return $this->_sanitizeSearchResponse($process, $params, $this->_queryTag(__FUNCTION__));
147150
} catch (Exception $e) {

src/Eloquent/Docs/ModelDocs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* @method $this chunk(string $column, Callable $callback, string $keepAlive = '5m')
5151
* @method $this chunkById(string $count, callable $callback, $column = '_id', $alias = null, $keepAlive = '5m')
5252
* @method $this queryNested(string $column, Callable $callback)
53-
* @method $this rawSearch(array $bodyParams)
53+
* @method $this rawSearch(array $bodyParams, bool $returnRaw = false)
5454
* @method $this rawAggregation(array $bodyParams)
5555
*
5656
* @method $this highlight(array $fields = [], string|array $preTag = '<em>', string|array $postTag = '</em>', $globalOptions = [])

src/Query/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,9 +1316,9 @@ public function createIndex()
13161316
return false;
13171317
}
13181318

1319-
public function rawSearch(array $bodyParams)
1319+
public function rawSearch(array $bodyParams, $returnRaw = false)
13201320
{
1321-
$find = $this->connection->searchRaw($bodyParams);
1321+
$find = $this->connection->searchRaw($bodyParams, $returnRaw);
13221322
$data = $find->data;
13231323

13241324
return new Collection($data);

0 commit comments

Comments
 (0)