Difference: FormattedSearch (23 vs. 24)

Revision 242012-04-18 - TWikiContributor

Line: 1 to 1
 
META TOPICPARENT name="TWikiVariables"

TWiki Formatted Search

Line: 50 to 50
 
$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
Changed:
<
<
$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{...}
Added:
>
>
$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
Line: 173 to 174
 
  1. If needed, format and output the result
  2. Else supress the search hit
Changed:
<
<
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))}%

Changed:
<
<
%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
Line: 189 to 190
 To get this:
Changed:
<
<
>
>
PearlineSapp TWikiRegistrationAgent 2021-08-03 - 12:03 1
TWikiUsers TWikiAdminUser 2021-08-03 - 12:03 303
AlStapleton AlStapleton 2021-08-03 - 11:34 2
RobertYoder TWikiRegistrationAgent 2021-08-03 - 07:16 1
KabitasaNayak TWikiRegistrationAgent 2021-08-03 - 05:42 1
FranklinDoty TWikiRegistrationAgent 2021-08-03 - 03:08 1
IlaVilla TWikiRegistrationAgent 2021-08-03 - 03:04 1
WebStatistics TWikiGuest 2021-08-02 - 16:44 723
SiteStatistics TWikiGuest 2021-08-02 - 11:19 486
AnnabelPoe TWikiRegistrationAgent 2021-08-02 - 10:56 1
JaimeGallo TWikiRegistrationAgent 2021-08-02 - 09:53 1
SanitasiaDas TWikiRegistrationAgent 2021-08-01 - 09:29 1
TawnyaColeman TWikiRegistrationAgent 2021-08-01 - 08:15 1
AdanHays AdanHays 2021-08-01 - 06:11 2
SheilaEarly SheilaEarly 2021-08-01 - 06:01 2
JacquesCooper JacquesCooper 2021-08-01 - 02:56 2
SankarsanBarma SankarsanBarma 2021-07-31 - 11:18 2
IntelBeach TWikiRegistrationAgent 2021-07-31 - 09:31 1
NayanArmy TWikiRegistrationAgent 2021-07-31 - 05:13 1
ReasonsWhyYouShouldBuyFromVitaminSupplementHerbalStore RosaleePrince 2021-07-31 - 02:14 1
RosaleePrince RosaleePrince 2021-07-31 - 02:14 2
AlisaStroud TWikiRegistrationAgent 2021-07-30 - 10:06 1
TannerMayo TannerMayo 2021-07-30 - 08:28 2
KristiHurley TWikiRegistrationAgent 2021-07-30 - 05:49 1
CharoletteCoker TWikiRegistrationAgent 2021-07-30 - 05:23 1
MaxieCooper TWikiRegistrationAgent 2021-07-29 - 10:27 1
AishamuellerGipson TWikiRegistrationAgent 2021-07-29 - 07:21 1
MarandaBauer TWikiRegistrationAgent 2021-07-28 - 10:22 1
JoseFitch TWikiRegistrationAgent 2021-07-28 - 05:44 1

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:

PearlineSapp TWikiRegistrationAgent 2021-08-03 - 12:03 1
TWikiUsers TWikiAdminUser 2021-08-03 - 12:03 303
AlStapleton AlStapleton 2021-08-03 - 11:34 2
RobertYoder TWikiRegistrationAgent 2021-08-03 - 07:16 1
KabitasaNayak TWikiRegistrationAgent 2021-08-03 - 05:42 1
FranklinDoty TWikiRegistrationAgent 2021-08-03 - 03:08 1
IlaVilla TWikiRegistrationAgent 2021-08-03 - 03:04 1
WebStatistics TWikiGuest 2021-08-02 - 16:44 723
SiteStatistics TWikiGuest 2021-08-02 - 11:19 486
AnnabelPoe TWikiRegistrationAgent 2021-08-02 - 10:56 1
JaimeGallo TWikiRegistrationAgent 2021-08-02 - 09:53 1
SanitasiaDas TWikiRegistrationAgent 2021-08-01 - 09:29 1
TawnyaColeman TWikiRegistrationAgent 2021-08-01 - 08:15 1
AdanHays AdanHays 2021-08-01 - 06:11 2
SheilaEarly SheilaEarly 2021-08-01 - 06:01 2
JacquesCooper JacquesCooper 2021-08-01 - 02:56 2
SankarsanBarma SankarsanBarma 2021-07-31 - 11:18 2
IntelBeach TWikiRegistrationAgent 2021-07-31 - 09:31 1
NayanArmy TWikiRegistrationAgent 2021-07-31 - 05:13 1
ReasonsWhyYouShouldBuyFromVitaminSupplementHerbalStore RosaleePrince 2021-07-31 - 02:14 1
RosaleePrince RosaleePrince 2021-07-31 - 02:14 2
AlisaStroud TWikiRegistrationAgent 2021-07-30 - 10:06 1
TannerMayo TannerMayo 2021-07-30 - 08:28 2
KristiHurley TWikiRegistrationAgent 2021-07-30 - 05:49 1
CharoletteCoker TWikiRegistrationAgent 2021-07-30 - 05:23 1
MaxieCooper TWikiRegistrationAgent 2021-07-29 - 10:27 1
AishamuellerGipson TWikiRegistrationAgent 2021-07-29 - 07:21 1
 

Embedding search forms to return a formatted result

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.FormattedSearch.