private function buildQueryFromKeywords($keywords,
$tables) { $keywordSelection =
[];
foreach ($keywords as $match) { $keywordSelection[] = 'SELECT ' .
$match->
getRelevance() . ' as relevance, ' .
$this->connection->
quote($match->
getTerm()) . ' as term, ' .
$match->
getId() . ' as keywordID';
} $keywordSelection =
implode("\n UNION ALL ",
$keywordSelection);
$tablesSql =
[];
foreach ($tables as $table) { $query =
$this->connection->
createQueryBuilder();
$alias = 'st' .
$table['tableID'
];
$query->
select(['MAX(sf.relevance * sm.relevance) as relevance', 'sm.keywordID', 'term'
]);
$query->
from('(' .
$keywordSelection . ')', 'sm'
);
$query->
innerJoin('sm', 's_search_index', 'si', 'sm.keywordID = si.keywordID'
);