Skip to content
Snippets Groups Projects
Commit 76754fea authored by Stanislav Vitvickiy's avatar Stanislav Vitvickiy Committed by Simonas Šerlinskas
Browse files

Adding param `track_total_hits` (#273)

parent 7a2c623b
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,14 @@ use ONGR\ElasticsearchDSL\SearchEndpoint\SuggestEndpoint;
*/
class Search
{
/**
* If you don’t need to track the total number of hits at all you can improve
* query times by setting this option to false. Defaults to true.
*
* @var bool
*/
private $trackTotalHits;
/**
* To retrieve hits from a certain offset. Defaults to 0.
*
......@@ -447,6 +455,24 @@ class Search
return $this;
}
/**
* @return bool
*/
public function isTrackTotalHits()
{
return $this->trackTotalHits;
}
/**
* @param bool $trackTotalHits
* @return $this
*/
public function setTrackTotalHits(bool $trackTotalHits)
{
$this->trackTotalHits = $trackTotalHits;
return $this;
}
/**
* @return int
*/
......@@ -719,6 +745,7 @@ class Search
'indicesBoost' => 'indices_boost',
'minScore' => 'min_score',
'searchAfter' => 'search_after',
'trackTotalHits' => 'track_total_hits',
];
foreach ($params as $field => $param) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment