$this->
join('search_total', 't', '[i].[word] = [t].[word]'
);
$this ->
condition('i.type',
$this->type
) ->
groupBy('i.type'
) ->
groupBy('i.sid'
);
// If the query is simple, we should have calculated the number of
// matching words we need to find, so impose that criterion. For non-
// simple queries, this condition could lead to incorrectly deciding not
// to continue with the full query.
if ($this->simple
) { $this->
having('COUNT(*) >= :matches',
[':matches' =>
$this->matches
]);
} // Clone the query object to calculate normalization.
$normalize_query =
clone $this->query;
// For complex search queries, add the LIKE conditions; if the query is
// simple, we do not need them for normalization.
if (!
$this->simple
) { $normalize_query->
join('search_dataset', 'd', '[i].[sid] = [d].[sid] AND [i].[type] = [d].[type] AND [i].[langcode] = [d].[langcode]'
);
if (count($this->conditions
)) { $normalize_query->
condition($this->conditions
);
}