protected function addSearchClauses(
        SearchableSubquery $subquery,
        ColumnCollection $columns,
        array $words,
        $threshold
    ) {
        $whereBindings = $this->searchSelect($subquery, $columns, $words, $threshold);

        // For morphOne/morphMany support we need to port the bindings from JoinClauses.
        $joinBindings = collect($subquery->getQuery()->joins)->flatMap(function ($join) {
            return $join->getBindings();
        })->all();

        $this->addBinding($joinBindings, 'select');

        // Developer may want to skip the score threshold filtering by passing zero
        // value as threshold in order to simply order full result by relevance.
        // Otherwise we are going to add where clauses for speed improvement.
        if ($threshold > 0) {
            $this->searchWhere($subquery, $columns, $words, $whereBindings);
        }

        $this->query->where('relevance', '>=', new Expression(number_format($threshold, 2)));

        $this->query->orders = array_merge(
            [['column' => 'relevance', 'direction' => 'desc']],
            (array) $this->query->orders
        );
    }
protected function addSearchClauses(
        SearchableSubquery $subquery,
        ColumnCollection $columns,
        array $words,
        $threshold
    ) {
        $whereBindings = $this->searchSelect($subquery, $columns, $words, $threshold);

        // For morphOne/morphMany support we need to port the bindings from JoinClauses.
        $joinBindings = collect($subquery->getQuery()->joins)->flatMap(function ($join) {
            return $join->getBindings();
        })->all();

        $this->addBinding($joinBindings, 'select');

        // Developer may want to skip the score threshold filtering by passing zero
        // value as threshold in order to simply order full result by relevance.
        // Otherwise we are going to add where clauses for speed improvement.
        if ($threshold > 0) {
            $this->searchWhere($subquery, $columns, $words, $whereBindings);
        }

        $this->query->where('relevance', '>=', new Expression(number_format($threshold, 2)));

        $this->query->orders = array_merge(
            [['column' => 'relevance', 'direction' => 'desc']],
            (array) $this->query->orders
        );
    }
protected function addSearchClauses ( SearchableSubquery $ subquery , ColumnCollection $ columns , array $ words , $ threshold ) { $ whereBindings = $ this -> searchSelect ( $ subquery , $ columns , $ words , $ threshold ) ; // For morphOne/morphMany support we need to port the bindings from JoinClauses. $ joinBindings = collect ( $ subquery -> getQuery ( ) -> joins ) -> flatMap ( function ( $ join ) { return $ join -> getBindings ( ) ; } ) -> all ( ) ; $ this -> addBinding ( $ joinBindings , 'select' ) ; // Developer may want to skip the score threshold filtering by passing zero // value as threshold in order to simply order full result by relevance. // Otherwise we are going to add where clauses for speed improvement. if ( $ threshold > 0 ) { $ this -> searchWhere ( $ subquery , $ columns , $ words , $ whereBindings ) ; } $ this -> query -> where ( 'relevance' , '>=' , new Expression ( number_format ( $ threshold , 2 ) ) ) ; $ this -> query -> orders = array_merge ( [ [ 'column' => 'relevance' , 'direction' => 'desc' ] ] , ( array ) $ this -> query -> orders ) ; }
Add select and where clauses on the subquery.

@param  \Sofa\Eloquence\Searchable\Subquery $subquery
@param  \Sofa\Eloquence\Searchable\ColumnCollection $columns
@param  array $words
@param  float $threshold
@return void
Add select and where clauses on the subquery .