- Posts: 6218
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
Less
More
4 years 10 months ago #174543
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 pagination doesn't show (hint: it's related to Falang)
@Bouey Thanks for joining us. Really appreciate it.
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?
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
Less
More
- Posts: 1
4 years 10 months ago #174552
by Pablo Torres LLamas
Replied by Pablo Torres LLamas on topic K2 pagination doesn't show (hint: it's related to Falang)
Using falang and having the same problem. I hope @Bouey can find a solution. Thank you.
Please Log in or Create an account to join the conversation.
- Bouey
- Offline
- New Member
Less
More
- Posts: 7
4 years 10 months ago #174553
by Bouey
Replied by Bouey on topic K2 pagination doesn't show (hint: it's related to Falang)
Yes i'm still on a solution.
@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
@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
Less
More
- Posts: 6218
4 years 10 months ago #174555
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 pagination doesn't show (hint: it's related to Falang)
Stéphane, the link from Percona is very old. If you skim through the more recent comments, you'll see that users report different results.
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.
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
Less
More
- Posts: 4
4 years 10 months ago #174584
by Vitaliy
Replied by Vitaliy on topic K2 pagination doesn't show (hint: it's related to Falang)
Good day. The problem was solved by installing the old version of K2 2.9.0 on top of K2 2.10.2. And Yes, the problem is a conflict between the new version 2.10.2 and the faLang component.
Please Log in or Create an account to join the conversation.
- Bouey
- Offline
- New Member
Less
More
- Posts: 7
4 years 10 months ago - 4 years 10 months ago #174586
by Bouey
Replied by Bouey on topic K2 pagination doesn't show (hint: it's related to Falang)
Hi,
i have a solution but need a small change in k2 file components/com_k2/models/itemlist.php line 338
if the falang driver is enabled the query is resend without asking for translation (probably use mysql cache) and the getTotal is set correctly
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
Last edit: 4 years 10 months ago by JoomlaWorks.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 10 months ago - 4 years 10 months ago #174593
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 pagination doesn't show (hint: it's related to Falang)
Stéphane, according to your site, Falang supports both Joomla 2.5 and 3.x. So I changed "Joomla\CMS\Plugin\PluginHelper" to "JPluginHelper" just in case.
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
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 :)
Last edit: 4 years 10 months ago by JoomlaWorks.
Please Log in or Create an account to join the conversation.
- Bouey
- Offline
- New Member
Less
More
- Posts: 7
4 years 10 months ago #174596
by Bouey
Replied by Bouey on topic K2 pagination doesn't show (hint: it's related to Falang)
Hi Fotis, it's seem only this change is enought .
i will look deeper monday.
Stéphane
i will look deeper monday.
Stéphane
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 10 months ago #174597
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 pagination doesn't show (hint: it's related to Falang)
Thank you Stéphane.
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
4 years 8 months ago #174991
by Geraldo de Oliveira
Replied by Geraldo de Oliveira on topic K2 pagination doesn't show (hint: it's related to Falang)
Hi Stéphane,
Any news about this? I'm still not seeing the pagination once the plugin is enabled.
Thanks...
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.
- Forum
- K2 Community Forum
- English K2 Community
- K2 pagination doesn't show (hint: it's related to Falang)