|
META TOPICPARENT |
name="TWikiVariables" |
TWiki Formatted Search |
|
$createusername |
Login name of topic revision 1, e.g. jsmith |
$createwikiname |
Wiki user name of topic revision 1, e.g. JohnSmith |
$createwikiusername |
Wiki user name of topic revision 1, e.g. Main.JohnSmith |
|
|
< < |
$summary |
Topic summary, just the plain text, all formatting and line breaks removed; up to 162 characters |
|
> > |
$summary |
Topic summary, just the plain text, all TWiki variables, formatting and line breaks removed; up to 162 characters |
|
|
$summary(50) |
Topic summary, up to 50 characters shown |
$summary(showvarnames) |
Topic summary, with %ALLTWIKI{...}% variables shown as ALLTWIKI{...} |
|
|
> > |
$summary(expandvar) |
Topic summary, with %ALLTWIKI{...}% variables expanded |
|
|
$summary(noheader) |
Topic summary, with leading ---+ headers removed Note: The tokens can be combined, for example $summary(100, showvarnames, noheader) |
$changes |
Summary of changes between latest rev and previous rev |
$changes(n) |
Summary of changes between latest rev and rev n |
|
|
- If needed, format and output the result
- Else supress the search hit
|
|
< < | This requires the TWiki:Plugins.SpreadSheetPlugin. The following example shows all topics that are up to exactly one week old. |
> > | This requires the TWiki:Plugins.SpreadSheetPlugin. The following example shows all topics in the Main web that have been updated in the last 7 days. |
|
Write this:
%CALC{$SET(weekold, $TIMEADD($TIME(), -7, day))}% |
|
< < | %SEARCH{ "." scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($date) < $GET(weekold), <nop>, | [[$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }% |
> > | %SEARCH{ "." scope="topic" type="regex" web="Main" nonoise="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($date) < $GET(weekold), <nop>, | [[$web.$topic][$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }% |
|
- The first line sets the
weekold variable to the serialized date of exactly one week ago
- The SEARCH has a deferred CALC. The
$percnt makes sure that the CALC gets executed once for each search hit
|
| To get this: |
|
< < | |
> > |
WAITFORDELAY00:00:20--][TWikiAdminGroup)WAITFORDELAY00:00:20--]] | TWikiGuest | 2024-01-05 - 08:04 | 20 |)
WAITFORDELAY00:00:00--][TWikiAdminGroup)WAITFORDELAY00:00:00--]] | TWikiGuest | 2024-01-05 - 08:04 | 20 |)
OR1in(1][TWikiAdminGroup)OR1in(1]] | TWikiGuest | 2024-01-05 - 08:00 | 20 |)
OR1in(0][TWikiAdminGroup)OR1in(0]] | TWikiGuest | 2024-01-05 - 08:00 | 20 |)
AND1in(1][TWikiAdminGroup)AND1in(1]] | TWikiGuest | 2024-01-05 - 07:59 | 20 |)
AND1in(0][TWikiAdminGroup)AND1in(0]] | TWikiGuest | 2024-01-05 - 07:58 | 20 |)
OR(1=0][TWikiAdminGroup)OR(1=0]] | TWikiGuest | 2024-01-05 - 07:49 | 20 |)
OR(1=1][TWikiAdminGroup)OR(1=1]] | TWikiGuest | 2024-01-05 - 07:48 | 20 |)
AND(1=1][TWikiAdminGroup)AND(1=1]] | TWikiGuest | 2024-01-05 - 07:43 | 20 |)
AND(1=0][TWikiAdminGroup)AND(1=0]] | TWikiGuest | 2024-01-05 - 07:42 | 20 |)
--][TWikiAdminGroupAND1=1)--]] | TWikiGuest | 2024-01-05 - 07:41 | 20 |)
--][TWikiAdminGroupAND1=0)--]] | TWikiGuest | 2024-01-05 - 07:40 | 20 |)
_][TWikiAdminGroupAND1=1)_]] | TWikiGuest | 2024-01-05 - 07:39 | 20 |)
_][TWikiAdminGroupAND1=0)_]] | TWikiGuest | 2024-01-05 - 07:38 | 20 |)
The condition can be anything you like. To restrict search based on a date range it is easier to use the date="" parameter as shown in the next example.
Restrict search based on a date range
A search can be restricted based on a date range. The following example is identical to the previous one, showing all topics in the Main web that have been updated in the last 7 days.
Write this:
%SEARCH{ "." scope="topic" type="regex" web="Main" nonoise="on" order="modified" reverse="on" format="| [[$web.$topic][$topic]] | $wikiusername | $date | $rev |" limit="100" date="P1w/$today" }%
To get this:
|
|
Embedding search forms to return a formatted result |