src/Search/Search.php
private function _doExecute(Query $query)
    {
        $collection = $this->documentManager->getCollection($this->documentClass);

        if ($this->isScroll()) {
            $scroll = $collection->scroll($query);

            foreach ($scroll as $resultSet) {
                yield $resultSet;
            }
        } else {
            yield $collection->search($query);
        }
    }
private function _doExecute(Query $query)
    {
        $collection = $this->documentManager->getCollection($this->documentClass);

        if ($this->isScroll()) {
            $scroll = $collection->scroll($query);

            foreach ($scroll as $resultSet) {
                yield $resultSet;
            }
        } else {
            yield $collection->search($query);
        }
    }
private function _doExecute ( Query $ query ) { $ collection = $ this -> documentManager -> getCollection ( $ this -> documentClass ) ; if ( $ this -> isScroll ( ) ) { $ scroll = $ collection -> scroll ( $ query ) ; foreach ( $ scroll as $ resultSet ) { yield $ resultSet ; } } else { yield $ collection -> search ( $ query ) ; } }
Executes the search action, yield all the result sets.

@param Query $query

@return \Generator|ResultSet[]
Executes the search action yield all the result sets .