Last modified: 2011-12-10 21:46:17 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.
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.
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?
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.
I see, so it sounds like counts are precalculated, and impose no performance penalty for large numbers. Is that correct?