Last modified: 2011-12-10 21:46:17 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T34944, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32944 - count= parameter does not count in relation to offset= parameter
count= parameter does not count in relation to offset= parameter
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-10 08:55 UTC by badon
Modified: 2011-12-10 21:46 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description badon 2011-12-10 08:55:34 UTC
If this produces the number 10:

{{#ask: [[Category:Some category]] | format=count}}

This will still produce the number 10:

{{#ask: [[Category:Some category]] | offset=1 | format=count}}

The correct behavior when offset would be for the count to be 10 - 1, for a total of 9.
Comment 1 Jeroen De Dauw 2011-12-10 16:16:11 UTC
The count "format" is a special case, and is actually not a format, and therefore does not support the regular parameters such as limit, sort and offset. Adding support for these makes little sense. And if you want to substract some number from the result, you can always use some substraction parser function.
Comment 2 badon 2011-12-10 21:20:15 UTC
I agree the "sort" parameter would make no sense. I'm not sure that "limit" would make no sense. I have considered using "limit" on counts when there are a lot of counts, to improve performance. 

For example, a query could be used to detect any count over 100, and then that information can be used to produce a links to several pages of further results, using queries like this:

{{#ask: [[Category:Some category]] | limit=101 | offset=0 | format=count}}

{{#ask: [[Category:Some category]] | limit=101 | offset=200 | format=count}}

{{#ask: [[Category:Some category]] | limit=101 | offset=300 | format=count}}

{{#ask: [[Category:Some category]] | limit=101 | offset=400 | format=count}}

Of course, I'm assuming that putting a limit on counts would improve performance, since I don't know how counts are produced internally (they may be cached, or produced by some fast method). I'm also guessing that these operations one at a time in sequence, only when requested would have better performance than doing them all at once on every page load.

When offset doesn't work, I suspect counts will not be accurate when the number exceeds $smwgQMaxLimit (I haven't tried it). I also suspect an offset ability would allow $smwgQMaxLimit to be set higher than the default 10000, with conscientious use of count, offset, and limit to ensure adequate performance. 

What do you think?
Comment 3 Jeroen De Dauw 2011-12-10 21:25:06 UTC
Count is an exception because it does not fetch a list of results and then counts those. It fetches the count. You cannot add a limit to this.
Comment 4 badon 2011-12-10 21:46:17 UTC
I see, so it sounds like counts are precalculated, and impose no performance penalty for large numbers. Is that correct?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links