- Posts: 6227
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- K2 pagination doesn't show (hint: it's related to Falang)
K2 pagination doesn't show (hint: it's related to Falang)
- JoomlaWorks
-
- Offline
- Admin
This is actually the recommend MySQL/MariaDB way for paginated data. Instead of doing 2 queries for the same thing, we only run a one for everything and second one which basically grabs the count from the first one. Since this is highly tied to performance (as K2 is used in some very large projects), I cannot revert any changes.
Additionally, since I'm leaning towards decoupling third-party integrations from K2 (to make development more flexible to be honest), I'd like to explore the possibility of having some else support Falang in K2, as a plugin. If it's technically possible on your side, would you be interested in that?
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Pablo Torres LLamas
-
- Offline
- New Member
- Posts: 1
Please Log in or Create an account to join the conversation.
- Bouey
-
- Offline
- New Member
- Posts: 7
@Fotis the SQL_CALC_FOUND_ROWS is a nice system but for performance a select count(*) is better
Se here some test:
www.percona.com/blog/2007/08/28/to-sql_calc_found_rows-or-not-to-sql_calc_found_rows/
Stéphane
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
And this is from the MySQL manual:
"If you are using SELECT SQL_CALC_FOUND_ROWS, MySQL must calculate how many rows are in the full result set. However, this is faster than running the query again without LIMIT, because the result set need not be sent to the client."
Since I happen to manage some of the highest traffic Joomla sites worldwide (dozens of millions of page views per month each), this change did wonders to performance. So it's been measured in production.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Vitaliy
-
- Offline
- New Member
- Posts: 4
Please Log in or Create an account to join the conversation.
- Bouey
-
- Offline
- New Member
- Posts: 7
i have a solution but need a small change in k2 file components/com_k2/models/itemlist.php line 338
<?php
if (count($rows)) {
//sbou
$falang_driver = Joomla\CMS\Plugin\PluginHelper::getPlugin('system', 'falangdriver');
if (!empty($falang_driver)) {
$db->setQuery($query, $limitstart, $limit);
$db->loadResult(false);
$db->setQuery('SELECT FOUND_ROWS();');
$this->getTotal = $db->loadResult(false);
return $rows;
}
//sbou
$db->setQuery('SELECT FOUND_ROWS();');
$this->getTotal = $db->loadResult();
}
if the falang driver is enabled the query is resend without asking for translation (probably use mysql cache) and the getTotal is set correctly
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Your changes have been merged: github.com/getk2/k2/commit/2127cf6f2ef8ad9a668ad2f7382f8c393d9fcdc8
By the way, since I had not committed the original code for either Joomfish or Falang myself, searching the K2's codebase for Falang I only found references in the itemlist.php model (the file you also edited). Have you had a look overall?
===
For anyone who wishes to try the updated version, please install K2 v2.10.3 (dev) from: getk2.org/downloads/?f=K2_Development_Release.zip
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Bouey
-
- Offline
- New Member
- Posts: 7
i will look deeper monday.
Stéphane
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Geraldo de Oliveira
-
- Offline
- New Member
Any news about this? I'm still not seeing the pagination once the plugin is enabled.
Thanks...
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Geraldo de Oliveira
-
- Offline
- New Member
Anyway, I'll wait for the stable 10.3 to upgrade. Now it's kinda of an emergency.
EDIT: Even with the fix from @Bouey it doesn't work so I've figured it out it's due to the K2 Multi Categories override located at /plugins/system/k2multiplecategories/overrides/site/components/com_k2/models/itemlist.php
I'll contact the developer once again to check this thread.
Thanks again.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Geraldo de Oliveira
-
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Fundceri
-
- Offline
- New Member
- Posts: 1
same problem here with Falang.
Couldn't make work the patch given by the developer. Is there any new about him?
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Bibliosalut
-
- Offline
- New Member
- Posts: 6
A Greeting
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Bibliosalut
-
- Offline
- New Member
- Posts: 6
I have already installed K2 v2.10.4 (dev) and there is no change, it looks exactly the same. I tried to change the protostar template and it doesn't work either. The only way to set the page is to disable the falang plugin but by doing that you won't be able to translate the web anymore.
A Greeting
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- K2 pagination doesn't show (hint: it's related to Falang)