User tests: Successful: Unsuccessful:
When creating PR #35341, we noticed that the _getListCount(Query)
of DataBaseModel.php
did not clear the order of the query in the second if-statement. Because it is not important for a count function in which order the results are placed and could represent a performance problem in the future when using other queries, so we have added the clear function.
In the method _getListCount(Query)
of DataBaseModel.php
the order was also cleared in the second if-statement.
Search Query contains an Order BY.
SELECT l.link_id, l.object,SUM(m.weight) AS ordering
FROM kaftq_finder_links AS l
INNER JOIN `kaftq_finder_links_terms` AS m ON m.link_id = l.link_id
WHERE `l`.`access` IN (:preparedArray1,:preparedArray2,:preparedArray3) AND l.state = 1 AND l.published = 1 AND (l.publish_start_date IS NULL OR l.publish_start_date <= '2021-08-25 08:24:00') AND (l.publish_end_date IS NULL OR l.publish_end_date >= '2021-08-25 08:24:00') AND m.term_id IN (11)
GROUP BY l.link_id,l.object
HAVING SUM(CASE WHEN m.term_id IN (11) THEN 1 ELSE 0 END) > 0
ORDER BY ordering DESC
Search Query no longer contains an Order BY.
SELECT l.link_id, l.object,SUM(m.weight) AS ordering
FROM kaftq_finder_links AS l
INNER JOIN `kaftq_finder_links_terms` AS m ON m.link_id = l.link_id
WHERE `l`.`access` IN (:preparedArray1,:preparedArray2,:preparedArray3) AND l.state = 1 AND l.published = 1 AND (l.publish_start_date IS NULL OR l.publish_start_date <= '2021-08-25 08:23:00') AND (l.publish_end_date IS NULL OR l.publish_end_date >= '2021-08-25 08:23:00') AND m.term_id IN (11)
GROUP BY l.link_id,l.object
HAVING SUM(CASE WHEN m.term_id IN (11) THEN 1 ELSE 0 END) > 0
Probably not.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
@richard67 Thanks for the feedback, comment has been added.
@socke300 I meant to extend the comment by your change so that the previously available information in that comment is not lost.
I.e. change
// Remove the limit and offset part if it's a DatabaseQuery object
to something like
// Remove the limit, offset and order parts if it's a DatabaseQuery object
But like you have done it now it only mentions the order part.
@richard67 Oh, I get it now, should I change it to // Remove the limit, offset and order parts if it's a DatabaseQuery object
and remove the comment underneath?
@richard67 Oh, I get it now, should I change it to
// Remove the limit, offset and order parts if it's a DatabaseQuery object
and remove the comment underneath?
@socke300 Yes.
I have tested this item
shouldn't this to be backported to 3.10 ?
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-08-26 10:58:57 |
Closed_By | ⇒ | bembelimen | |
Labels |
Added:
?
|
Thanks
@socke300 Maybe you should also change the comment in line 181 to reflect your change?
joomla-cms/libraries/src/MVC/Model/BaseDatabaseModel.php
Line 181 in 5d2cdf4