Issue:Problem with count & includematch

From FollowTheScore
Revision as of 04:45, 18 February 2009 by Jb (talk | contribs) (Problem)
Jump to: navigation, search
Description: There is an unanticipated behavior when using param 'count' with param 'includematch', resulting in an inability to limit the number of returned results.
Extension / Version: DPL   /   1.7.4
Type / Status: Change Request   /   open

Problem

What I'm trying to achieve is this -- select top 3 pages matching 'includematch'.

When I set 'count=3' in my DPL query, the includematch regex is applied within the MySQL result set (whose query ends with LIMIT 0 3). Thus, I get includematch applied to the top 3 articles in the MySQL query. For most pages, this is very few. Thus, I set count=100 or some other value, and return the number of pages that happen to match.

The workaround I came up with is to pass %NR% to the template call, and put an

{{#ifexpr:{{{%NR%}}}<3|* [[{{{%PAGE%}}}}]}}

into my template.dpl call, which effectively limits the number of returned results to 3 by displaying nothing for %NR%>=3. I had to modify the DPL code ever so slightly to pass the %NR% param to the template, but it appears to work OK.

It would be nice to use another param (like 'limitcount=3') to achieve this more efficiently, so that the Mediawiki parser engine doesn't have to parse every template for %NR%>=3.

See detailed DPL query at wikidoc.org.

Reply