Engine/ChainEngine.php
public function search($query)
    {
        $results = new ResultCollection();

        foreach ($this->engines as $eachEngine) {
            if (!$eachEngine->supports($query)) {
                continue;
            }

            if ($more = $eachEngine->search($query)) {
                if (!is_array($more) and !$more instanceof \Traversable) {
                    throw new DomainException('The returned result set is not traversable.');
                }

                foreach ($more as $eachResult) {
                    $results->add($eachResult);
                }
            }
        }

        return $results;
    }
public function search($query)
    {
        $results = new ResultCollection();

        foreach ($this->engines as $eachEngine) {
            if (!$eachEngine->supports($query)) {
                continue;
            }

            if ($more = $eachEngine->search($query)) {
                if (!is_array($more) and !$more instanceof \Traversable) {
                    throw new DomainException('The returned result set is not traversable.');
                }

                foreach ($more as $eachResult) {
                    $results->add($eachResult);
                }
            }
        }

        return $results;
    }
Perform the search based on the query.

The query may be anything, from a simple search string to a complex query structure.
It's based on a contract between the engine and the application.

@param mixed $query

@return ResultInterface[]|ResultCollection