Item10932: SEARCH's topic
param visits each topic only once, even if a topic occurs multiple times
Priority: Low
Current State: Needs Developer
Released In: n/a
Target Release: patch
Applies To: Engine
Component: FORMAT,
SEARCH
Branches:
The following
SEARCH has a really useful undocumented ... bug? feature?
%SEARCH{"1"
type="query"
topic="Item10000,Item10000,Item10000,Item10001"
format=" * [[$web.$topic][$topic]]"
}%
Test:
Number of topics: 2
As you can see, it visits each topic in the
topic
param only once, even if it's listed multiple times. This doesn't align with the FORMAT equivalent:
%FORMAT{
"Item10000,Item10000,Item10000,Item10001"
type="topic"
format=" * [[$web.$topic][$topic]]"
}%
Test:
PaulAlexander has therefore started exploiting this behaviour for cases where we need to process each member of a list only once, even if a member occurs more than once in that list.
The example use-case is a
SEARCH that generates this list of topics into another
SEARCH's
topic
param (thus unique-ifying it). The inner
SEARCH is finding a list of all
slvalues[property='Cite'].value
in a set of topics - the result is we can build a list of bibliographic references in use across a set of topics (and have each reference occur only once in that list).
So the question is:
- Document the behaviour, and fix FORMAT to behave the same
- Fix the behaviour, make SEARCH behave the same as FORMAT
- In this case, what mechanism can we use to reliably unique a list? CALC's rendering behaviour is too crazy for me to bother with I'm afraid.
--
PaulHarvey - 29 Jun 2011
Sorry to set this
WaitingFor the
SEARCH gurus again, but I guess this affects
ResultSets or something complicated like that...
--
PaulHarvey - 30 Jun 2011
On IRC Sven seemed indifferent, but favoured making the behaviour align with whatever an older T/Foswiki does.
--
PaulHarvey - 30 Jun 2011
Our very own
Foswiki 1.0.9 on foswiki.org (which I'd forgotten about) shows us that
SEARCH's treatment of the
topic
param is consistent across Foswiki 1.0, Foswiki 1.1, and trunk
--
PaulHarvey - 30 Jun 2011