|
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: |
|
< < |
Could not perform search. Error was: RCS: /usr/bin/rlog -h %FILENAME|F% of .../TWiki/TWikiRegistration.txt,v failed:
|
> > |
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 |