Skip to content

Commit

Permalink
[5.2]postgres and finder suggestions (#44384)
Browse files Browse the repository at this point in the history
  • Loading branch information
alikon authored Nov 27, 2024
1 parent 6a66618 commit d685790
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/com_finder/src/Model/SuggestionsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ protected function getListQuery()
$db = $this->getDatabase();
$termIdQuery = $db->getQuery(true);
$termQuery = $db->getQuery(true);
$aQuery = $db->getQuery(true);

// Limit term count to a reasonable number of results to reduce main query join size
$termIdQuery->select('ti.term_id')
Expand All @@ -93,9 +94,9 @@ protected function getListQuery()
}

// Select required fields
$termQuery->select('DISTINCT(t.term)')
$termQuery->select('t.term, t.links, t.weight')
->from($db->quoteName('#__finder_terms', 't'))
->whereIn('t.term_id', $termIds)
->where('t.term_id in (' . implode(',', $termIds) . ')')
->order('t.links DESC')
->order('t.weight DESC');

Expand All @@ -108,8 +109,8 @@ protected function getListQuery()
->where('l.access IN (' . implode(',', $groups) . ')')
->where('l.state = 1')
->where('l.published = 1');

return $termQuery;
$aQuery->select('DISTINCT o.term')->from('(' . $termQuery . ') AS o');
return $aQuery;
}

/**
Expand Down

0 comments on commit d685790

Please sign in to comment.