Devise\Search\SearchableModelTrait::filterQueryWithRelevance PHP Method

filterQueryWithRelevance() protected method

Adds where clauses to this query based on the relevance
protected filterQueryWithRelevance ( &$query, $relevance_count )
    protected function filterQueryWithRelevance(&$query, $relevance_count)
    {
        $total = 0;
        $totalColumns = 0;
        $this->totalWords = $this->totalWords > 0 ? $this->totalWords : 1;
        foreach ($this->getColumns() as $column => $relevance) {
            $totalColumns++;
            $total += $relevance * $this->totalWords;
        }
        $query->havingRaw('relevance >= ' . $total / ($this->totalWords + $totalColumns));
        $query->orderBy('relevance', 'desc');
    }