I created a view that has a global combined fields filter setup to search through node's title and a set of taxonomy terms. It works fine but only if I include a "Taxonomy term: Name" field.

This field currently causes each node to appear in the results for each term that is assigned to it. I checked Aggregation Settings for that field but only have these options:[options]1

I also tried the Views Distinct module which worked but at a great performance cost. Is there either:

  1. a way I can include terms in the global combine fields filter that I haven't thought of or
  2. a way to prevent the duplicate results?

Thanks for your help

2 Answers 2


You can apply GROUP BY or DISTINCT by enabling views aggregation settings to remove duplicate records.

  1. Go and edit your view
  2. In Advanced » OTHER section by enabling Use aggregation: Yes
  3. In FIELDS or FILTER CRITERIA section, select and apply Aggregation settings for which fields you want to group by or distinct.

Put this code in your themes template.php file:

function your-theme_views_pre_render(&$view) {
 $used_nids = array();
$new_view_result = array();

 if ($view->name == 'Name_of_your_view') {
foreach ($view->result as $row) {
    if (!in_array($row->nid, $used_nids)) {
      $new_view_result[] = $row;
      $used_nids[] = $row->nid;

$view->result = $new_view_result;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.