Item10324: zeroresults="0" doesn't print anything
It should emit a numeric "0" if this search comes up with nothing:
Error: no such plugin chili
%SEARCH{"asdfbargleghjkl" excludetopic="%TOPIC%" type="query" zeroresults="0"}%
Result:
I guess the code measures whether something is false instead of whether it's defined
--
PaulHarvey - 07 Feb 2011
mmm, I see what you might expect, but...
from the foswiki 1.0 docco:
zeroresults="off" |
Suppress all output if there are no hits |
zeroresults="on", displays: "Number of topics: 0" |
vs the foswiki trunk docco:
| zeroresults="off"
or zeroresults="..."| Suppress/replace all output if there are no hits - can also be set to a
FormattedSearch? string to customise the output | zeroresults="on" - displays the summary, and number of topics found. "Number of topics: 0" |
now, here's the pain. boolean parameters in foswiki macros are evaluated in a perl-ish (is that orc-ish?) way
so I
think the wat to get what you want, is to use NOP or somesuch
tossing in a unit test to see
eg:
Error: no such plugin chili
%SEARCH{"asdfbargleghjkl" excludetopic="%TOPIC%" type="query" zeroresults="%NOP%0"}%
Result: 0
I'm not sure that we can resolve this safely
and consistently with other boolean params - so I wimpled (sic) out and just added a little docco and some unit tests showing the madness.
If you disagree - excellent
I think a
<nop>/%NOP% is fine. Personally I've always encouraged use of
on and
off, but I agree with what you've done.
--
PaulHarvey - 18 Feb 2011