Hi all, I have been working on this plugin for almost two months now, and I have just incorporated to it the changes with fmt from version 4.22. I think it's time I make it available to other people, even though I haven't tested it for all possible cases so far, and I'm pretty sure it is not yet ready to replace the current search function. So... what's the purpose of this? And how to use it?
Let's start with a few examples of how I'm using it, before we try and
decipher its structure:
- <(multisearch group={p}.* if='! equal {+:cat} "date"' when='inlist
{+:cat} "logement"|inlist {+:cat} "bureau"|true'
template='subpageslistlog|subpageslistbur|subpageslist' count=false
type=-{zones})>
The result of this example will be three lists, the first containing all
children pages for which the data var 'cat' is different from date and
contains "logement", formatted according to template "subpageslistlog";
then the second list will contain all children pages for which the data var
'cat' is different from date and contains "bureau", formatted according to
template "subpageslistbur"; and the last list will contain all all children
pages for which the data var 'cat' is different from "date", including all
the previous ones, formatted according to template "subpageslist".
Without using the "if" parameter and the "true" condition, I could also
have used my function like this:
<(multisearch group={p}.* when='inlist {+:cat} "logement"|inlist {+:cat}
"bureau"|! equal {+:cat} "date"'
template='subpageslistlog|subpageslistbur|subpageslist' count=false
type=-{zones})>
but the performances would have been a little worse because the "if"
parameter is applied before the "when" is and a lot of non-matching pages
(the ones for which the "cat" is equal to "date" and thus does not contain
"logement" nor "bureau") would have been discarded 3 times instead of once
at the beginning.
The displayed result will be the same as the following lines, but my
function has better perfomance:
<(search group={p}.* if='inlist {+:cat} "logement"'
template='subpageslistlog' count=false type=-{zones})>
<(search group={p}.* if='inlist {+:cat} "bureau"'
template='subpageslistbur' count=false type=-{zones})>
<(search group={p}.* if='! equal {+:cat} "date"' template='subpageslist'
count=false type=-{zones})>
- [(multisearch
group=character.apc.+,character.npc.+,character.pc.+.+,character.epc.+.+
classification="{+:birthlastname}" sort="{+:birthlastname}
{+:birthfirstname}" type=-{zones} fmt="[[{+p}|+]] : {+:birthlastname}
{+:birthfirstname}" count=false)]
The result of this example will be a sequel of lists such as:
-
.... : - Abc
.... : - Bdf
A
... : Aj Ncew
... : Az Acmeowi
B
... : Bpodw Ceriu
- [(multisearch group=character.* if='set {+:sort}'
classification={+:birthdateyear}
sort={+:birthlastname},{+:birthfirstname},{+:birthmiddlenames}
type=-{zones} template=listebiopersos count=false)]
1990
- Abc
Az Acmeowi
1996
Aj Ncew
Bpodw Ceriu
2002
- Bdf
- [(multisearch group=jeu.* when='inlist {+:cat} "logement"%inlist
{+:cat} "bureau"' template='optionhome%optionwork' whensep='%' count=false
type=-{zones})]
You can notice 3 additional parameters: "when", "whensep" and
"classification":
- "whensep" specifies what to consider as condition and subgroup
separator in "when", "fmt" and "template". It is the symbol "|" by default,
but you can see I used "%" instead in the last example.
- "when" tells the different conditions to be met, it is like
transforming the "if" from the "search" function into some kind of
switch/case. For each of these conditions, you need to give a "template" or
an "fmt" value that will be applied to the matching pages, following the
same order as the conditions', and using the same separator ("|" or the one
given by "whensep"). You can give condition "true" if you want a template
to be applied to all pages returned by the search (it means that you don't
add any condition to you search).
- "classification" this one can be used to regroup the pages according
to a given criterion, it's like an overall ordering in which the pages will
be sorted according to the "sort" parameter. Right now, if the criterion is
alphanumeric, it will group the results by the first letter of its value;
but the whole value will be taken into account if the criterion is a
number. This "regrouping" is applied before the conditional introduced by
"when"; is it processed in the same time as "include", "exclude", "if" and
"sort" parameters.
You can see "when" as an extension of the "if" parameter from "search" and
"classification" as an extension of the "sort" parameter from "search", but
"if" and "sort" are still taken into account.
As I said at the beginning of this email, there are still improvements to
be done, and the major changes are in the displaying part, so this could
probably also be applied to the other functions, such as list...
Cheers,
Tiffany
--
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/d/optout.
<<attachment: multisearch.php>>
