diff --git a/src/ElasticEngine.php b/src/ElasticEngine.php index 3e0e084..819a0da 100755 --- a/src/ElasticEngine.php +++ b/src/ElasticEngine.php @@ -153,6 +153,12 @@ public function buildSearchQueryPayloadCollection(Builder $builder, array $optio $payload->setIfNotEmpty($clauseKey, $clauseValue); } + $settings = $builder->model->getSearchSettings(); + foreach ($settings as $setting => $value) { + $settingKey = 'body.'.$setting; + $payload->setIfNotEmpty($settingKey, $value); + } + return $payload->get(); }); } diff --git a/src/Searchable.php b/src/Searchable.php index bd5da47..8bccc1c 100644 --- a/src/Searchable.php +++ b/src/Searchable.php @@ -73,6 +73,17 @@ public function getSearchRules() $this->searchRules : [SearchRule::class]; } + /** + * Get the search rules. + * + * @return array + */ + public function getSearchSettings() + { + return isset($this->searchSettings) && count($this->searchSettings) > 0 ? + $this->searchSettings : []; + } + /** * Execute the search. *