NOTE: If you are a developer, please use a private wiki based on foswiki/trunk on a daily base ...or use trunk.foswiki.org to view this page for some minimal testing.
Use Item11746 for general documentation changes for release 1.1.6. Use Item9693 for docu changes for release 1.2 and 2.0.

Item10324: zeroresults="0" doesn't print anything

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Normal Closed Engine SEARCH Main.CrawfordCurrie, Main.PaulHarvey, Main.SvenDowideit
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 frown

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 smile


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

 

ItemTemplate edit

Summary zeroresults="0" doesn't print anything
ReportedBy PaulHarvey
Codebase 1.1.2, 1.1.1, 1.1.0, 1.1.0 beta1, trunk
SVN Range
AppliesTo Engine
Component SEARCH
Priority Normal
CurrentState Closed
WaitingFor CrawfordCurrie, PaulHarvey, SvenDowideit
Checkins Foswikirev:10717 Foswikirev:10718
TargetRelease patch
ReleasedIn 1.1.3
Topic revision: 16 Apr 2011, KennethLavrsen
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads