You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by "Glen Mazza (JIRA)" <ji...@apache.org> on 2015/12/31 04:26:49 UTC
[jira] [Updated] (ROL-1756) getMostCommentedWeblogs() doesn't
return most commented weblogs unless called with limit = -1
[ https://issues.apache.org/jira/browse/ROL-1756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Glen Mazza updated ROL-1756:
----------------------------
Assignee: (was: Glen Mazza)
> getMostCommentedWeblogs() doesn't return most commented weblogs unless called with limit = -1
> ---------------------------------------------------------------------------------------------
>
> Key: ROL-1756
> URL: https://issues.apache.org/jira/browse/ROL-1756
> Project: Apache Roller
> Issue Type: Bug
> Components: Data Model & JPA Backend
> Affects Versions: 4.0
> Environment: Doesn't look environment-specific. Environment was: Roller 4.0, MySQL 5.0, unknown Java version.
> Reporter: Anil Gangolli
> Priority: Minor
>
> This issue was originally reported by Guglielmo Carandente <g....@cnmedia.it>
> If you call getMostCommentedWeblogs() with a limit value other than -1, it may not actually return the most commented weblogs.
> This getMostCommentedWeblogs() method is exposed as part of the site model and the call goes down to WeblogEntryManager.getMostCommentedWeblogEntries().
> The problem results because the query itself does not do any ordering on its result set because (according to a comment near the query definition) of a restriction in JPA QL, yet if you pass a limit value other than -1 the query result set is limited to the specified size. The ordering is then done by sorting the results in the Java code within the method WeblogEntryManager.getMostCommentedWeblogEntries(). So if you limit of the result set, it may not contain the most commented entries. You'll just end up sorting the first n entries returned by the query where n is the value of limit passed.
> To work around this bug, you can pass -1 for the length limit and then limit the number of results you actually display in your velocity template.
> The performance of this workaround may not be acceptable if you have a large number of blogs on the site.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)