Completed
Push — master-4.0 ( 2eaeb5...874289 )
by Krzysztof
05:46 queued 03:18
created

ScrollingSearchingContext::getResults()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace KGzocha\Searcher\Context\Elastica;
4
5
use Elastica\Query;
6
use Elastica\Search;
7
8
/**
9
 * @author Krzysztof Gzocha <[email protected]>
10
 */
11
class ScrollingSearchingContext extends QuerySearchingContext
12
{
13
    /**
14
     * @var string
15
     */
16
    private $expiryTime;
17
18
    /**
19
     * @inheritDoc
20
     */
21
    public function __construct(Search $search, Query $query = null, $expiryTime = '1m')
22
    {
23
        parent::__construct($search, $query);
24
        $this->expiryTime = $expiryTime;
25
    }
26
27
    /**
28
     * @return \Elastica\Scroll
29
     */
30
    public function getResults()
31
    {
32
        $this
33
            ->getSearch()
34
            ->setQuery($this->getQueryBuilder());
35
36
        return $this->getSearch()->scroll($this->expiryTime);
37
    }
38
}
39