1head 1.28; 2access; 3symbols; 4locks; strict; 5comment @# @; 6 7 81.28 9date 2018.07.14.23.53.43; author TWikiContributor; state Exp; 10branches; 11next 1.27; 12 131.27 14date 2015.02.25.06.11.26; author TWikiContributor; state Exp; 15branches; 16next 1.26; 17 181.26 19date 2014.03.22.20.56.35; author TWikiContributor; state Exp; 20branches; 21next 1.25; 22 231.25 24date 2013.04.23.03.11.05; author TWikiContributor; state Exp; 25branches; 26next 1.24; 27 281.24 29date 2012.04.18.21.03.53; author TWikiContributor; state Exp; 30branches; 31next 1.23; 32 331.23 34date 2011.11.02.19.14.06; author TWikiContributor; state Exp; 35branches; 36next 1.22; 37 381.22 39date 2010.05.29.14.44.15; author TWikiContributor; state Exp; 40branches; 41next 1.21; 42 431.21 44date 2009.03.30.09.17.55; author TWikiContributor; state Exp; 45branches; 46next 1.20; 47 481.20 49date 2008.12.06.09.02.11; author TWikiContributor; state Exp; 50branches; 51next 1.19; 52 531.19 54date 2008.01.22.03.21.27; author TWikiContributor; state Exp; 55branches; 56next 1.18; 57 581.18 59date 2007.01.16.04.12.00; author TWikiContributor; state Exp; 60branches; 61next 1.17; 62 631.17 64date 2006.04.01.05.55.06; author TWikiContributor; state Exp; 65branches; 66next 1.16; 67 681.16 69date 2006.02.01.12.01.16; author TWikiContributor; state Exp; 70branches; 71next 1.15; 72 731.15 74date 2004.07.27.02.42.49; author PeterThoeny; state Exp; 75branches; 76next 1.14; 77 781.14 79date 2004.05.08.21.54.29; author PeterThoeny; state Exp; 80branches; 81next 1.13; 82 831.13 84date 2004.03.17.06.55.00; author PeterThoeny; state Exp; 85branches; 86next 1.12; 87 881.12 89date 2003.12.16.07.39.28; author PeterThoeny; state Exp; 90branches; 91next 1.11; 92 931.11 94date 2003.09.29.00.32.53; author PeterThoeny; state Exp; 95branches; 96next 1.10; 97 981.10 99date 2003.09.08.05.24.47; author PeterThoeny; state Exp; 100branches; 101next 1.9; 102 1031.9 104date 2002.08.13.16.46.44; author PeterThoeny; state Exp; 105branches; 106next 1.8; 107 1081.8 109date 2002.05.17.06.57.28; author PeterThoeny; state Exp; 110branches; 111next 1.7; 112 1131.7 114date 2002.04.20.02.37.00; author PeterThoeny; state Exp; 115branches; 116next 1.6; 117 1181.6 119date 2002.02.18.06.22.45; author PeterThoeny; state Exp; 120branches; 121next 1.5; 122 1231.5 124date 2002.02.16.19.13.13; author PeterThoeny; state Exp; 125branches; 126next 1.4; 127 1281.4 129date 2002.01.15.06.14.17; author PeterThoeny; state Exp; 130branches; 131next 1.3; 132 1331.3 134date 2001.12.02.12.33.20; author MikeMannix; state Exp; 135branches; 136next 1.2; 137 1381.2 139date 2001.11.29.07.02.46; author PeterThoeny; state Exp; 140branches; 141next 1.1; 142 1431.1 144date 2001.10.25.02.13.01; author PeterThoeny; state Exp; 145branches; 146next ; 147 148 149desc 150@none 151@ 152 153 1541.28 155log 156@buildrelease 157@ 158text 159@%META:TOPICINFO{author="TWikiContributor" date="1531612423" format="1.1" version="28"}% 160%META:TOPICPARENT{name="TWikiVariables"}% 161%STARTINCLUDE% 162---+ TWiki Formatted Search 163 164_Inline search feature allows flexible formatting of search result_ 165 166The default output format of a =[[VarSEARCH][%<nop>SEARCH{...}%]]= is a table consisting of topic names and topic summaries. Use the =format="..."= parameter to customize the search result. The format parameter typically defines a bullet or a table row containing variables, such as =%<nop>SEARCH{ "food" format="| $topic | $summary |" }%=. See =[[VarSEARCH][%<nop>SEARCH{...}%]]= for other search parameters, such as =separator=""=. 167 168%TOC% 169 170---++ Syntax 171 172Three parameters can be used to customize a search result: 173 174---+++ 1. =header="..."= parameter 175 176Use the header parameter to specify the header of a search result. It should correspond to the format of the format parameter. This parameter is optional. <br /> Example: =header="| <nop>*Topic:*<nop> | <nop>*Summary:*<nop> |"= 177 178Variables that can be used in the header string: 179 180| *Name:* | *Expands To:* | 181| =$web= | Name of the web | 182%INCLUDE{FormatTokens}% 183 184---+++ 2. =format="..."= parameter 185 186Use the format parameter to specify the format of one search hit. 187<br /> Example: =format="| $topic | $summary |"= 188 189Variables that can be used in the format string: 190 191| *Name:* | *Expands To:* | 192| =$web= | Name of the web | 193| =$topic= | Topic name | 194| =$topic(<i>20</i>)= | Topic name, "<tt>- </tt>" hyphenated each 20 characters | 195| =$topic(<i>30, -<br /></i>)= | Topic name, hyphenated each 30 characters with separator "<tt>-<br /></tt>" | 196| =$topic(<i>40, ...</i>)= | Topic name, shortened to 40 characters with "<tt>...</tt>" indication | 197| =$topictitle= | Topic title, in order of sequence defined by: Form field named "Title", topic preference setting named TITLE, topic name | 198| =$parent= | Name of parent topic; empty if not set | 199| =$parent(<i>20</i>)= | Name of parent topic, same hyphenation/shortening like =$topic()= | 200| =$text= | Formatted topic text. In case of a =multiple="on"= search, it is the line found for each search hit. | 201| =$text(encode:<i>type</i>)= | Same as above, but encoded in the specified _type_. Possible types are the same as in [[VarENCODE][ENCODE]]. Though =ENCODE= can take the =extra= parameter, =$text(encode:<i>type</i>)= cannot. Example: =$text(encode:html)= | 202| =$locked= | LOCKED flag (if any) | 203| =$date= | Time stamp of last topic update, e.g. =%GMTIME{"$year-$mo-$day - $hour:$min"}%= | 204| =$isodate= | Time stamp of last topic update, e.g. =%GMTIME{"$year-$mo-$dayT$hour:$minZ"}%= | 205| =$rev= | Number of last topic revision, e.g. =4= | 206| =$username= | Login name of last topic update, e.g. =jsmith= | 207| =$wikiname= | Wiki user name of last topic update, e.g. =<nop>JohnSmith= | 208| =$wikiusername= | Wiki user name of last topic update, like =%USERSWEB%.<nop>JohnSmith= | 209| =$createdate= | Time stamp of topic revision 1 | 210| =$createusername= | Login name of topic revision 1, e.g. =jsmith= | 211| =$createwikiname= | Wiki user name of topic revision 1, e.g. =<nop>JohnSmith= | 212| =$createwikiusername= | Wiki user name of topic revision 1, e.g. =%USERSWEB%.<nop>JohnSmith= | 213| =$summary= | Topic summary, just the plain text, all TWiki variables, formatting and line breaks removed; up to 162 characters | 214| =$summary(<i>50</i>)= | Topic summary, up to 50 characters shown | 215| =$summary(showvarnames)= | Topic summary, with =%<nop>ALLTWIKI{...}%= variables shown as =ALLTWIKI{...}= | 216| =$summary(expandvar)= | Topic summary, with =%<nop>ALLTWIKI{...}%= variables expanded | 217| =$summary(noheader)= | Topic summary, with leading =---+ headers= removed%BR% __Note:__ The tokens can be combined, for example =$summary(100, showvarnames, noheader)= | 218| =$changes= | Summary of changes between latest rev and previous rev | 219| =$changes(<i>n</i>)= | Summary of changes between latest rev and rev n | 220| =$formname= | The name of the form attached to the topic; empty if none | 221| =$formfield(<i>name</i>)= | The field value of a form field; for example, =$formfield(<nop>TopicClassification)= would get expanded to =PublicFAQ=. This applies only to topics that have a [[TWikiForms][TWikiForm]] | 222| =$formfield(<i>name</i>, encode:<i>type</i>)= | Form field value, encoded in the specified _type_. Possible types are the same as in [[VarENCODE][ENCODE]]: =quote=, =moderate=, =safe=, =entity=, =html=, =url= and =csv=. The =encode:<i>type</i>= parameter can be combined with other parameters described below, but it needs to be the last parameter. Example: =$formfield(Description, 20, encode:html)= | 223| =$formfield(<i>name</i>, render:display)= | Form field value, rendered for display. For example, a form field of type color will render as a colored box. If not specified, the raw value is returned, such as a color value =#336699=. The =render:display= parameter can be combined with other parameters, but must be used after the parameters described below. | 224| =$formfield(<i>name, 10</i>)= | Form field value, "<tt>- </tt>" hyphenated each 10 characters | 225| =$formfield(<i>name, 20, -<br /></i>)= | Form field value, hyphenated each 20 characters with separator "<tt>-<br /></tt>" | 226| =$formfield(<i>name, 30, ...</i>)= | Form field value, shortened to 30 characters with "<tt>...</tt>" indication | 227| =$query(<i>query-syntax</i>)= | Access topic meta data using SQL-like QuerySearch syntax. Example: %BB% =$query(attachments.arraysize)= returns the number of files attached to the current topic %BB% =$query(attachments[name~'*.gif'].size)= returns an array with size of all =.gif= attachments, such as =848, 1425, 923= %BB% =$query(parent.name)= is equivalent to =$parent= | 228| =$query(<i>query-syntax</i>, quote:<i>"</i>)= | Strings in QuerySearch result are quoted with the specified quote. Useful to triple-quote strings for use in SpreadSheetPlugin's CALCULATE, such as =$query(attachments.comment, quote:''')= which returns a list of triple-quoted attachment comment strings -- the spreadhseet funcions will work properly even if comment strings contain commas and parenthesis | 229| =$query(<i>query-syntax</i>, encode:<i>type</i>)= | QuerySearch result is encoded in the specified _type_. This is in parallel to =$formfield(<i>name</i>, encode:<i>type</i>)= mentioned above | 230| =$pattern(<i>reg-exp</i>)= | A regular expression pattern to extract some text from a topic (does not search meta data; use =$formfield= instead). In case of a =multiple="on"= search, the pattern is applied to the line found in each search hit.%BB% Specify a RegularExpression that covers the whole text (topic or line), which typically starts with =.*=, and must end in =.*= %BB% Put text you want to keep in parenthesis, like =$pattern(.*?(from here.*?to here).*)= %BB% Example: =$pattern(.*?\*.*?Email\:\s*([^\n\r]+).*)= extracts the e-mail address from a bullet of format =* Email: ...= %BB% This example has non-greedy =.*?= patterns to scan for the first occurance of the Email bullet; use greedy =.*= patterns to scan for the last occurance %BB% Limitation: Do not use =.*)= inside the pattern, e.g. =$pattern(.*foo(.*)bar.*)= does not work, but =$pattern(.*foo(.*?)bar.*)= does %BB% Note: Make sure that the integrity of a web page is not compromised; for example, if you include an HTML table make sure to include everything including the table end tag | 231| =$pattern(<i>reg-exp</i>, encode:<i>type</i>)= | A text extracted by _reg-exp_ is encoded in the specified _type_. This is in parallel to =$formfield(<i>name</i>, encode:<i>type</i>)= mentioned above | 232| =$count(<i>reg-exp</i>)= | Count of number of times a regular expression pattern appears in the text of a topic (does not search meta data). Follows guidelines for use and limitations outlined above under =$pattern(reg-exp)=. Example: =$count(.*?(---[+][+][+][+]) .*)= counts the number of <H4> headers in a page. | 233| =$ntopics= | Number of topics found in current web. This is the current topic count, not the total number of topics | 234| =$tntopics= | The total number of topics matched | 235| =$nwebs= | The number of webs searched | 236| =$nhits= | Number of hits if =multiple="on"=. Cumulative across all topics in current web. Identical to =$ntopics= unless =multiple="on"= | 237%INCLUDE{FormatTokens}% 238 239---+++ 3. =footer="..."= parameter 240 241Use the footer parameter to specify the footer of a search result. It should correspond to the format of the format parameter. This parameter is optional. <br /> Example: =footer="| <nop>*Topic*<nop> | <nop>*Summary*<nop> |"= 242 243Variables that can be used in the footer string: 244 245| *Name:* | *Expands To:* | 246| =$web= | Name of the web | 247| =$ntopics= | Number of topics found in current web | 248| =$tntopics= | The total number of topics matched | 249| =$nwebs= | The number of webs searched | 250| =$nhits= | Number of hits if =multiple="on"=. Cumulative across all topics in current web. Identical to =$ntopics= unless =multiple="on"= | 251%INCLUDE{FormatTokens}% 252 253---+++ 4. =default="..."= parameter 254 255Use the default parameter to specify a default message if there are no hits in a web. This parameter is optional. <br /> Example: =default="| <nop>*Note*<nop> | Nothing found in the [<nop>[$web.WebHome][$web]<nop>] web |"= 256 257Variables that can be used in the default string: 258 259| *Name:* | *Expands To:* | 260| =$web= | Name of the web | 261%INCLUDE{FormatTokens}% 262 263---++ Results pagination 264 265When a search return many results, you may want to paginate them having the following line below the results. 266 267[[#A][«Prev]] [[#A][1]] *2* [[#A][3]] [[#A][4]] [[#A][5]] [[#A][Next»]] 268 269SearchResultsPagination describes how to do it. 270 271#EvaluationOrder 272---++ Evaluation order of variables 273 274By default, variables embedded in the format parameter of =%<nop>SEARCH{}%= are evaluated once _before_ the search. This is OK for variables that do not change, such as =%<nop>SCRIPTURLPATH%=. Variables that should be evaluated once per search hit _must be escaped_. For example, to escape a conditional: 275<br /> = %<nop>IF{ "..." then="..." else="..." }%= 276<br /> write this: 277<br /> = format="$percntIF{ \"...\" then=\"...\" else=\"...\" }$percnt"= 278 279---++ Examples 280 281Here are some samples of formatted searches. The SearchPatternCookbook has other examples, such as [[SearchPatternCookbook#SearchUsernames][creating a picklist of usernames]], [[SearchPatternCookbook#SearchTopicChildren][searching for topic children]] and more. 282 283#SearchBulletList 284---+++ Bullet list showing topic name and summary 285 286*Write this:* 287 288<verbatim> 289%SEARCH{ 290 "FAQ" 291 scope="topic" 292 nosearch="on" 293 nototal="on" 294 header=" * *Topic: Summary:*" 295 format=" * [[$topic]]: $summary" 296 footer=" * *Topic: Summary*" 297}% 298</verbatim> 299 300*To get this:* 301 302%SEARCH{ 303 "FAQ" 304 scope="topic" 305 nosearch="on" 306 nototal="on" 307 header=" * *Topic: Summary:*" 308 format=" * [[$topic]]: $summary" 309 footer=" * *Topic: Summary*" 310}% 311 312 313---+++ Table showing form field values of topics with a form 314 315In a web where there is a form that contains a =Topic<nop>Classification= field, an =Operating<nop>System= field and an =Os<nop>Version= field we could write: 316 317=| <nop>*Topic:*<nop> | <nop>*<nop>OperatingSystem:*<nop> | <nop>*<nop>OsVersion:*<nop> |= <br /> 318=%<nop>SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" type="regex" nosearch="on" nototal="on" format="| [<nop>[$topic]] | $formfield(<nop>OperatingSystem) | $formfield(<nop>OsVersion) |" }%= 319 320To get this: 321 322| *Topic:* | *OperatingSystem* | *OsVersion* | 323| [[%TOPIC%][IncorrectDllVersionW32PTH10DLL]] | [[%TOPIC%][OsWin]] | 95/98 | 324| [[%TOPIC%][WinDoze95Crash]] | [[%TOPIC%][OsWin]] | 95 | 325 326 327---+++ Extract some text from a topic using regular expression 328 329*Write this:* 330 331<verbatim> 332%SEARCH{ 333 "__Back to\:__ TWikiFAQ" 334 scope="text" 335 type="regex" 336 nosearch="on" 337 nototal="on" 338 header="TWiki FAQs:" 339 format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" 340}% 341</verbatim> 342 343*To get this:* 344 345%SEARCH{ 346 "__Back to\:__ TWikiFAQ" 347 scope="text" 348 type="regex" 349 nosearch="on" 350 nototal="on" 351 header="TWiki FAQs:" 352 format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" 353}% 354 355 356---+++ Nested Search 357 358Search can be nested. For example, search for some topics, then form a new search for each topic found in the first search. The idea is to build the nested search string using a formatted search in the first search. 359 360Here is an example. Let's search for all topics that contain the word "culture" (first search), and let's find out where each topic found is linked from (second search). 361 362 * First search: 363 * =%<nop>SEARCH{ "culture" format=" * $topic is referenced by: (list all references)" nosearch="on" nototal="on" }%= 364 * Second search. For each hit we want this search: 365 * =%<nop>SEARCH{ "(topic found in first search)" format="$topic" nosearch="on" nototal="on" separator=", " }%= 366 * Now let's nest the two. We need to escape the second search, e.g. the first search will build a valid second search string. Note that we escape the second search so that it does not get evaluated prematurely by the first search: 367 * Use =$percnt= to escape the leading percent of the second search 368 * Use =\"= to escape the double quotes 369 * Use =$dollar= to escape the =$= of =$topic= 370 * Use =$nop= to escape the =}%= sequence 371 372*Write this:* 373 374<verbatim> 375%SEARCH{ 376 "culture" 377 format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" 378 nosearch="on" 379 nototal="on" 380}% 381</verbatim> 382 383*To get this:* 384 385%SEARCH{ 386 "culture" 387 format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" 388 nosearch="on" 389 nototal="on" 390}% 391 392__Note:__ Nested search can be slow, especially if you nest more then 3 times. Nesting is limited to 16 levels. For each new nesting level you need to "escape the escapes", e.g. write =$dollarpercntSEARCH{= for level three, =$dollardollarpercntSEARCH{= for level four, etc. 393 394__Note:__ Another option, instead of a nested search, is to create a *hash*. Refer to the blog TWiki:Blog.BlogEntry201603x1. A search using hashes, if possible, may be significantly faster than a nested search. 395 396---+++ Most recently changed pages 397 398*Write this:* 399 400<verbatim> 401%SEARCH{ 402 "\.*" 403 scope="topic" 404 type="regex" 405 nosearch="on" 406 nototal="on" 407 sort="modified" 408 reverse="on" 409 format="| [[$topic]] | $wikiusername | $date |" 410 limit="7" 411}%= 412</verbatim> 413 414*To get this:* 415 416%SEARCH{ 417 "\.*" 418 scope="topic" 419 type="regex" 420 nosearch="on" 421 nototal="on" 422 sort="modified" 423 reverse="on" 424 format="| [[$topic]] | $wikiusername | $date |" 425 limit="7" 426}% 427 428---+++ Search with conditional output 429 430A regular expression search is flexible, but there are limitations. For example, you cannot show all topics that are up to exactly one week old, or create a report that shows all records with invalid form fields or fields within a certain range, etc. You need some additional logic to format output based on a condition: 431 1. Specify a search which returns more hits then you need 432 1. For each search hit apply a spreadsheet formula to determine if the hit is needed 433 1. If needed, format and output the result 434 1. Else supress the search hit 435 436This requires the TWiki:Plugins.SpreadSheetPlugin. The following example shows all topics in the %USERSWEB% web that have been updated in the last 7 days. 437 438*Write this:* 439 440=%<nop>CALCULATE{$SET(weekold, $TIMEADD($TIME(), -7, day))}%= %BR% 441=%<nop>SEARCH{ "." scope="topic" type="regex" web="%USERSWEB%" nonoise="on" sort="modified" reverse="on" format="$percntCALCULATE{$IF($TIME($date) < $GET(weekold), <nop>, | [<nop>[$web.$topic][$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }%= 442 443 * The first line sets the =weekold= variable to the serialized date of exactly one week ago 444 * The SEARCH has a deferred CALCULATE. The =$percnt= makes sure that the CALCULATE gets executed once for each search hit 445 * The CALCULATE compares the date of the topic with the =weekold= date 446 * If topic is older, a =<nop>= is returned, which gets removed at the end of the TWiki rendering process 447 * Otherwise, the search hit is formatted and returned 448 * This example is for illustration only, it is easier to use the =date="..."= paramter in [[VarSEARCH][SEARCH]] to restrict the date. 449 450*To get this:* 451 452%CALCULATE{$SET(weekold, $TIMEADD($TIME(), -7, day))}% 453%SEARCH{ "." scope="topic" type="regex" web="%USERSWEB%" nonoise="on" sort="modified" reverse="on" format="$percntCALCULATE{$IF($TIME($date) < $GET(weekold), <nop>, | [[$web.$topic][$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }% 454 455The 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. 456 457---+++ Restrict search based on a date range 458 459A search can be restricted based on a [[TimeSpecifications][date range]]. The following example is identical to the previous one, showing all topics in the %USERSWEB% web that have been updated in the last 7 days. 460 461*Write this:* 462 463<verbatim> 464%SEARCH{ 465 "." 466 scope="topic" 467 type="regex" 468 web="%USERSWEB%" 469 nonoise="on" 470 sort="modified" 471 reverse="on" 472 format="| [[$web.$topic][$topic]] | $wikiusername | $date | $rev |" 473 limit="100" 474 date="P1w/$today" 475}%= 476</verbatim> 477 478*To get this:* 479 480%SEARCH{ 481 "." 482 scope="topic" 483 type="regex" 484 web="%USERSWEB%" 485 nonoise="on" 486 sort="modified" 487 reverse="on" 488 format="| [[$web.$topic][$topic]] | $wikiusername | $date | $rev |" 489 limit="100" 490 date="P1w/$today" 491}% 492 493---+++ Embedding search forms to return a formatted result 494 495Use an HTML form and an embedded formatted search on the same topic. You can link them together with an =%<nop>URLPARAM{"..."}%= variable. Example: 496 497*Write this:* 498 499<verbatim> 500<form action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%"> 501Find Topics: 502<input type="text" name="q" size="32" value="%URLPARAM{"q" encode="entity"}%" /> <input type="submit" class="twikiSubmit" value="Search" /> 503</form> 504Result: 505%SEARCH{ 506 search="%URLPARAM{"q" encode="search"}%" 507 type="keyword" 508 format=" * $web.$topic: %BR% $summary" 509 nosearch="on" 510}% 511</verbatim> 512 513*To get this:* 514 515<form action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%"> 516Find Topics: 517<input type="text" name="q" size="32" value="%URLPARAM{"q" encode="entity"}%" /> <input type="submit" class="twikiSubmit" value="Search" /> 518</form> 519Result: 520%SEARCH{ 521 search="%URLPARAM{"q" encode="search"}%" 522 type="keyword" 523 format=" * $web.$topic: %BR% $summary" 524 nosearch="on" 525}% 526 527__Related Topics:__ UserDocumentationCategory, SearchHelp, VarSEARCH, VarENCODE, SearchResultsPagination, SearchPatternCookbook, RegularExpression, QuerySearch 528 529-- __Contributors:__ TWiki:Main.PeterThoeny, TWiki:Main.CrawfordCurrie, TWiki:Main.SopanShewale 530@ 531 532 5331.27 534log 535@buildrelease 536@ 537text 538@d1 1 539a1 1 540%META:TOPICINFO{author="TWikiContributor" date="1424844686" format="1.1" version="27"}% 541d236 2 542d348 1 543a348 1 544 search="%URLPARAM{"q" encode="quote"}%" 545d363 1 546a363 1 547 search="%URLPARAM{"q" encode="quote"}%" 548@ 549 550 5511.26 552log 553@buildrelease 554@ 555text 556@d1 1 557a1 1 558%META:TOPICINFO{author="TWikiContributor" date="1395521795" format="1.1" version="26"}% 559d65 1 560@ 561 562 5631.25 564log 565@buildrelease 566@ 567text 568@d1 1 569a1 1 570%META:TOPICINFO{author="TWikiContributor" date="1366686665" format="1.1" version="25"}% 571d43 1 572a43 1 573| =$text(encode:<i>type</i>)= | Same as above, but encoded in the specified _type_. Possible types are the same as [[VarENCODE][ENCODE]]. Though =ENCODE= can take the =extra= parameter, =$text(encode:<i>type</i>)= cannot. e.g. =$text(encode:html)= | 574d45 1 575a45 1 576| =$date= | Time stamp of last topic update, e.g. =%GMTIME{"$day $mon $year - $hour:$min"}%= | 577d64 1 578a64 1 579| =$formfield(<i>name</i>, encode:<i>type</i>)= | Form field value, encoded in the specified _type_. This is in parallel to =$text(encode:<i>type</i>)= shown above. Comma followed by =encode:<i>type</i>= can be added to the =$formfield(...)= syntax below as well. But it needs to be the last paramer. e.g. =$formfield(Description, 20, encode:html)= | 580d69 2 581a70 1 582| =$query(<i>query-syntax</i>, encode:<i>type</i>)= | QuerySearch result is encoded in the specified _type_. This is in parallel to =$text(encode:<i>type</i>)= mentioned above | 583d72 1 584a72 1 585| =$pattern(<i>reg-exp</i>, encode:<i>type</i>)= | A text extracted by _reg-exp_ is encoded in the specified _type_. This is in parallel to =$text(encode:<i>type</i>)= mentioned above | 586@ 587 588 5891.24 590log 591@buildrelease 592@ 593text 594@d1 1 595a1 1 596%META:TOPICINFO{author="TWikiContributor" date="1334783033" format="1.1" version="24"}% 597d39 1 598d43 1 599d64 1 600d69 1 601d71 1 602d74 2 603d88 2 604d93 18 605d128 11 606a138 1 607=%<nop>SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * <nop>*Topic: Summary:*" format=" * [<nop>[$topic]]: $summary" footer=" * <nop>*Topic: Summary*" }%= 608d142 9 609a150 1 610%SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * *Topic: Summary:*" format=" * [[$topic]]: $summary" footer=" * *Topic: Summary*" }% 611d171 11 612a181 1 613=%<nop>SEARCH{ "__Back to\:__ <nop>TWikiFAQ" scope="text" type="regex" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [<nop>[$topic][Answer...]]" }%= 614d185 9 615a193 1 616%SEARCH{ "__Back to\:__ TWikiFAQ" scope="text" type="regex" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" }% 617d214 8 618a221 1 619=%<nop>SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" nosearch="on" nototal="on" }%= 620d225 6 621a230 1 622%SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" nosearch="on" nototal="on" }% 623d238 13 624a250 1 625=%<nop>SEARCH{ "\.*" scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="| [<nop>[$topic]] | $wikiusername | $date |" limit="7" }%= 626d254 11 627a264 1 628%SEARCH{ "\.*" scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="| [[$topic]] | $wikiusername | $date |" limit="7" }% 629d278 2 630a279 2 631=%<nop>CALC{$SET(weekold, $TIMEADD($TIME(), -7, day))}%= %BR% 632=%<nop>SEARCH{ "." scope="topic" type="regex" web="%USERSWEB%" nonoise="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($date) < $GET(weekold), <nop>, | [<nop>[$web.$topic][$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }%= 633d282 2 634a283 2 635 * The SEARCH has a deferred CALC. The =$percnt= makes sure that the CALC gets executed once for each search hit 636 * The CALC compares the date of the topic with the =weekold= date 637d286 1 638d290 2 639a291 2 640%CALC{$SET(weekold, $TIMEADD($TIME(), -7, day))}% 641%SEARCH{ "." scope="topic" type="regex" web="%USERSWEB%" nonoise="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($date) < $GET(weekold), <nop>, | [[$web.$topic][$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }% 642d301 14 643a314 1 644=%<nop>SEARCH{ "." scope="topic" type="regex" web="%USERSWEB%" nonoise="on" order="modified" reverse="on" format="| [<nop>[$web.$topic][$topic]] | $wikiusername | $date | $rev |" limit="100" date="P1w/$today" }%= 645d318 12 646a329 1 647%SEARCH{ "." scope="topic" type="regex" web="%USERSWEB%" nonoise="on" order="modified" reverse="on" format="| [[$web.$topic][$topic]] | $wikiusername | $date | $rev |" limit="100" date="P1w/$today" }% 648d343 6 649a348 1 650%SEARCH{ search="%URLPARAM{"q" encode="quote"}%" type="keyword" format=" * $web.$topic: %BR% $summary" nosearch="on" }% 651d358 6 652a363 1 653%SEARCH{ search="%URLPARAM{"q" encode="quote"}%" type="keyword" format=" * $web.$topic: %BR% $summary" nosearch="on" }% 654d365 1 655a365 1 656__Related Topics:__ UserDocumentationCategory, SearchHelp, VarSEARCH, SearchPatternCookbook, RegularExpression, QuerySearch 657@ 658 659 6601.23 661log 662@buildrelease 663@ 664text 665@d1 1 666a1 1 667%META:TOPICINFO{author="TWikiContributor" date="1320261246" format="1.1" version="23"}% 668d53 1 669a53 1 670| =$summary= | Topic summary, just the plain text, all formatting and line breaks removed; up to 162 characters | 671d56 1 672d177 1 673a177 1 674This requires the TWiki:Plugins.SpreadSheetPlugin. The following example shows all topics that are up to exactly one week old. 675d182 1 676a182 1 677=%<nop>SEARCH{ "." scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($date) < $GET(weekold), <nop>, | [<nop>[$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }%= 678d193 15 679a207 1 680%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" }% 681@ 682 683 6841.22 685log 686@buildrelease 687@ 688text 689@d1 1 690a1 1 691%META:TOPICINFO{author="TWikiContributor" date="1265789704" format="1.1" version="22"}% 692d14 1 693a14 1 694Two parameters can be used to specify a customized search result: 695d26 1 696a26 14 697---+++ 2. =footer="..."= parameter 698 699Use the footer parameter to specify the footer of a search result. It should correspond to the format of the format parameter. This parameter is optional. <br /> Example: =footer="| <nop>*Topic*<nop> | <nop>*Summary*<nop> |"= 700 701Variables that can be used in the footer string: 702 703| *Name:* | *Expands To:* | 704| =$web= | Name of the web | 705| =$ntopics= | Number of topics found in current web | 706| =$nhits= | Number of hits if =multiple="on"=. Cumulative across all topics in current web. Identical to =$ntopics= unless =multiple="on"= | 707%INCLUDE{FormatTokens}% 708 709 710---+++ 3. =format="..."= parameter 711d38 1 712a38 1 713| =$topic(<i>40, ...</i>)= | Topic name, shortended to 40 characters with "<tt>...</tt>" indication | 714d63 1 715a63 1 716| =$formfield(<i>name, 30, ...</i>)= | Form field value, shortended to 30 characters with "<tt>...</tt>" indication | 717d71 20 718d116 3 719a118 12 720<table border="1" cellspacing="0" cellpadding="1"> 721<tr> 722 <th bgcolor="#99CCCC"> <strong>Topic:</strong> </th> 723 <th bgcolor="#99CCCC"> <strong>OperatingSystem:</strong> </th> 724 <th bgcolor="#99CCCC"> <strong>OsVersion:</strong> </th></tr> 725<tr> 726 <td> <a href="%SCRIPTURLPATH{"view"}%/Sandbox/IncorrectDllVersionW32PTH10DLL">IncorrectDllVersionW32PTH10DLL</a> </td><td> <a href="%SCRIPTURLPATH{"view"}%/Sandbox/OsWin">OsWin</a> </td><td> 95/98 </td></tr> 727<tr> 728 <td> <a href="%SCRIPTURLPATH{"view"}%/Sandbox/WinDoze95Crash">WinDoze95Crash</a> </td> 729 <td> <a href="%SCRIPTURLPATH{"view"}%/Sandbox/OsWin">OsWin</a> </td> 730 <td> 95 </td></tr> 731</table> 732@ 733 734 7351.21 736log 737@buildrelease 738@ 739text 740@d1 1 741a1 1 742%META:TOPICINFO{author="TWikiContributor" date="1233913375" format="1.1" version="21"}% 743d49 3 744a51 3 745| =$topic(20)= | Topic name, "<tt>- </tt>" hyphenated each 20 characters | 746| =$topic(30, -<br />)= | Topic name, hyphenated each 30 characters with separator "<tt>-<br /></tt>" | 747| =$topic(40, ...)= | Topic name, shortended to 40 characters with "<tt>...</tt>" indication | 748d53 1 749a53 1 750| =$parent(20)= | Name of parent topic, same hyphenation/shortening like =$topic()= | 751d67 1 752a67 1 753| =$summary(50)= | Topic summary, up to 50 characters shown | 754d71 1 755a71 1 756| =$changes(n)= | Summary of changes between latest rev and rev n | 757d73 7 758a79 6 759| =$formfield(name)= | The field value of a form field; for example, =$formfield(<nop>TopicClassification)= would get expanded to =PublicFAQ=. This applies only to topics that have a [[TWikiForms][TWikiForm]] | 760| =$formfield(name, 10)= | Form field value, "<tt>- </tt>" hyphenated each 10 characters | 761| =$formfield(name, 20, -<br />)= | Form field value, hyphenated each 20 characters with separator "<tt>-<br /></tt>" | 762| =$formfield(name, 30, ...)= | Form field value, shortended to 30 characters with "<tt>...</tt>" indication | 763| =$pattern(reg-exp)= | A regular expression pattern to extract some text from a topic (does not search meta data; use =$formfield= instead). In case of a =multiple="on"= search, the pattern is applied to the line found in each search hit.%BB% Specify a RegularExpression that covers the whole text (topic or line), which typically starts with =.*=, and must end in =.*= %BB% Put text you want to keep in parenthesis, like =$pattern(.*?(from here.*?to here).*)= %BB% Example: =$pattern(.*?\*.*?Email\:\s*([^\n\r]+).*)= extracts the e-mail address from a bullet of format =* Email: ...= %BB% This example has non-greedy =.*?= patterns to scan for the first occurance of the Email bullet; use greedy =.*= patterns to scan for the last occurance %BB% Limitation: Do not use =.*)= inside the pattern, e.g. =$pattern(.*foo(.*)bar.*)= does not work, but =$pattern(.*foo(.*?)bar.*)= does %BB% Note: Make sure that the integrity of a web page is not compromised; for example, if you include an HTML table make sure to include everything including the table end tag | 764| =$count(reg-exp)= | Count of number of times a regular expression pattern appears in the text of a topic (does not search meta data). Follows guidelines for use and limitations outlined above under =$pattern(reg-exp)=. Example: =$count(.*?(---[+][+][+][+]) .*)= counts the number of <H4> headers in a page. | 765d220 1 766a220 1 767__Related Topics:__ UserDocumentationCategory, SearchHelp, TWikiVariables#VarSEARCH, SearchPatternCookbook, RegularExpression 768@ 769 770 7711.20 772log 773@buildrelease 774@ 775text 776@d1 1 777a1 1 778%META:TOPICINFO{author="TWikiContributor" date="1228163901" format="1.1" version="20"}% 779d26 14 780a39 1 781---+++ 2. =format="..."= parameter 782d79 2 783d92 1 784a92 1 785=%<nop>SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * <nop>*Topic: Summary:*" format=" * [<nop>[$topic]]: $summary" }%= 786d96 1 787a96 1 788%SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * *Topic: Summary:*" format=" * [[$topic]]: $summary" }% 789d221 1 790a221 1 791-- __Contributors:__ TWiki:Main.PeterThoeny, TWiki:Main.CrawfordCurrie 792@ 793 794 7951.19 796log 797@buildrelease 798@ 799text 800@d1 1 801a1 1 802%META:TOPICINFO{author="TWikiContributor" date="1168735492" format="1.1" version="19"}% 803d189 1 804a189 1 805<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" /> <input type="submit" class="twikiSubmit" value="Search" /> 806d192 1 807a192 1 808%SEARCH{ search="%URLPARAM{"q"}%" format=" * $web.$topic: %BR% $summary" nosearch="on" }% 809d199 1 810a199 1 811<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" /> <input type="submit" class="twikiSubmit" value="Search" /> 812d202 1 813a202 1 814%SEARCH{ search="%URLPARAM{"q"}%" format=" * $web.$topic: %BR% $summary" nosearch="on" }% 815@ 816 817 8181.18 819log 820@buildrelease 821@ 822text 823@d1 1 824a1 1 825%META:TOPICINFO{author="TWikiContributor" date="1168735492" format="1.1" version="18"}% 826a2 1 827%TOC% 828d4 1 829a4 1 830---# TWiki Formatted Search 831d10 2 832d24 1 833a24 5 834| =$n= or =$n()= | New line. Use =$n()= if followed by alphanumeric character, e.g. write =Foo$n()Bar= instead of =Foo$nBar= | 835| =$nop= or =$nop()= | Is a "no operation". This variable gets removed; useful for nested search | 836| =$quot= | Double quote (="=). Alternatively write =\"= to escape it | 837| =$percnt= | Percent sign (=%=) | 838| =$dollar= | Dollar sign (=$=) | 839d48 1 840a48 1 841| =$wikiusername= | Wiki user name of last topic update, like =%MAINWEB%.<nop>JohnSmith= | 842d52 1 843a52 1 844| =$createwikiusername= | Wiki user name of topic revision 1, e.g. =%MAINWEB%.<nop>JohnSmith= | 845d66 1 846a66 6 847| =$n= or =$n()= | New line. Use =$n()= if followed by alphanumeric character, e.g. write =Foo$n()Bar= instead of =Foo$nBar= | 848| =$nop= or =$nop()= | Is a "no operation". This variable gets removed; useful for nested search | 849| =$quot= | Double quote (="=). Alternatively write =\"= to escape it | 850| =$percnt= | Percent sign (=%=) | 851| =$dollar= | Dollar sign (=$=) | 852 853@ 854 855 8561.17 857log 858@buildrelease 859@ 860text 861@d1 1 862a1 1 863%META:TOPICINFO{author="TWikiContributor" date="1111929255" format="1.1" version="17"}% 864d15 1 865a15 1 8661. =header="..."= parameter 867d19 11 868a29 1 8692. =format="..."= parameter 870d78 1 871d97 1 872a97 1 873=%<nop>SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" regex="on" nosearch="on" nototal="on" format="| [<nop>[$topic]] | $formfield(<nop>OperatingSystem) | $formfield(<nop>OsVersion) |" }%= 874d119 1 875a119 1 876=%<nop>SEARCH{ "__Back to\:__ <nop>TWikiFAQ" scope="text" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [<nop>[$topic][Answer...]]" }%= 877d123 1 878a123 1 879%SEARCH{ "__Back to\:__ TWikiFAQ" scope="text" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" }% 880d156 1 881a156 1 882=%<nop>SEARCH{ "\.*" scope="topic" regex="on" nosearch="on" nototal="on" order="modified" reverse="on" format="| [<nop>[$topic]] | $wikiusername | $date |" limit="7" }%= 883d160 1 884a160 1 885%SEARCH{ "\.*" scope="topic" regex="on" nosearch="on" nototal="on" order="modified" reverse="on" format="| [[$topic]] | $wikiusername | $date |" limit="7" }% 886d175 1 887a175 1 888=%<nop>SEARCH{ "." scope="topic" regex="on" nosearch="on" nototal="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($date) < $GET(weekold), <nop>, | [<nop>[$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }%= 889d186 1 890a186 1 891%SEARCH{ "." scope="topic" regex="on" nosearch="on" nototal="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($date) < $GET(weekold), <nop>, | [[$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }% 892d212 1 893a212 1 894__Related Topics:__ UserDocumentationCategory 895d214 1 896@ 897 898 8991.16 900log 901@buildrelease 902@ 903text 904@d1 1 905a1 1 906%META:TOPICINFO{author="TWikiContributor" date="1111929255" format="1.1" version="16"}% 907d9 1 908a9 1 909The default output format of a =[[TWikiVariables#VarSEARCH][%<nop>SEARCH{...}%]]= is a table consisting of topic names and topic summaries. Use the =format="..."= parameter to customize the search result. The format parameter typically defines a bullet or a table row containing variables, such as =%<nop>SEARCH{ "food" format="| $topic | $summary |" }%=. 910d74 1 911a74 1 912=%<nop>SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * <nop>*Topic: Summary:*" format=" * [<nop>[$topic]]: $summary" }%= 913d78 1 914a78 1 915%SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * *Topic: Summary:*" format=" * [[$topic]]: $summary" }% 916d108 1 917a108 1 918=%<nop>SEARCH{ "__Back to\:__ <nop>TWikiFAQ" scope="text" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [<nop>[$topic][Answer...]]" }%= 919d112 1 920a112 1 921%SEARCH{ "__Back to\:__ TWikiFAQ" scope="text" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" }% 922d121 9 923a129 9 924 * First search: 925 * =%<nop>SEARCH{ "culture" format=" * $topic is referenced by: (list all references)" nosearch="on" nototal="on" }%= 926 * Second search. For each hit we want this search: 927 * =%<nop>SEARCH{ "(topic found in first search)" format="$topic" nosearch="on" nototal="on" separator=", " }%= 928 * Now let's nest the two. We need to escape the second search, e.g. the first search will build a valid second search string. Note that we escape the second search so that it does not get evaluated prematurely by the first search: 929 * Use =$percnt= to escape the leading percent of the second search 930 * Use =\"= to escape the double quotes 931 * Use =$dollar= to escape the =$= of =$topic= 932 * Use =$nop= to escape the =}%= sequence 933d133 1 934a133 1 935=%<nop>SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" nosearch="on" nototal="on" }%= 936d137 1 937a137 1 938%SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" nosearch="on" nototal="on" }% 939d154 4 940a157 4 941 1. Specify a search which returns more hits then you need 942 1. For each search hit apply a spreadsheet formula to determine if the hit is needed 943 1. If needed, format and output the result 944 1. Else supress the search hit 945d166 5 946a170 5 947 * The first line sets the =weekold= variable to the serialized date of exactly one week ago 948 * The SEARCH has a deferred CALC. The =$percnt= makes sure that the CALC gets executed once for each search hit 949 * The CALC compares the date of the topic with the =weekold= date 950 * If topic is older, a =<nop>= is returned, which gets removed at the end of the TWiki rendering process 951 * Otherwise, the search hit is formatted and returned 952d189 1 953a189 1 954%SEARCH{ search="%URLPARAM{"q"}%" format=" * $web.$topic: %BR% $summary" nosearch="on" }% 955d199 1 956a199 1 957%SEARCH{ search="%URLPARAM{"q"}%" format=" * $web.$topic: %BR% $summary" nosearch="on" }% 958@ 959 960 9611.15 962log 963@none 964@ 965text 966@d1 1 967a1 1 968%META:TOPICINFO{author="PeterThoeny" date="1090896168" format="1.0" version="1.15"}% 969d5 1 970a5 1 971---# TWiki Formatted Search Results 972d9 1 973a9 1 974The =[[TWikiVariables#VarSEARCH][%<nop>SEARCH{...}%]]= variable documented in TWikiVariables has a fixed format for the search result, that is, a table consisting of topic names and topic summaries. Use the =format="..."= parameter to specify a customized format of the search result. The string of the format parameter is typically a bullet list or table row containing variables (such as =%<nop>SEARCH{ "food" format="| $topic | $summary |" }%=). 975d38 1 976a38 1 977| =$rev= | Number of last topic revision, e.g. =1.4= | 978d42 10 979a51 5 980| =$createdate= | Time stamp of topic revision 1.1 | 981| =$createusername= | Login name of topic revision 1.1, e.g. =jsmith= | 982| =$createwikiname= | Wiki user name of topic revision 1.1, e.g. =<nop>JohnSmith= | 983| =$createwikiusername= | Wiki user name of topic revision 1.1, e.g. =%MAINWEB%.<nop>JohnSmith= | 984| =$summary= | Topic summary | 985d57 3 986a59 2 987| =$pattern(reg-exp)= | A regular expression pattern to extract some text from a topic (does not search meta data; use =$formfield= instead). In case of a =multiple="on"= search, the pattern is applied to the line found in each search hit.%BB% Specify a RegularExpression that covers the whole text (topic or line), which typically starts with =.*=, and must end in =.*= %BB% Put text you want to keep in parenthesis, like =$pattern(.*?(from here.*?to here).*)= %BB% Example: =$pattern(.*?\*.*?Email\:\s*([^\n\r]+).*)= extracts the email address from a bullet of format =* Email: ...= %BB% This example has non-greedy =.*?= patterns to scan for the first occurance of the Email bullet; use greedy =.*= patterns to scan for the last occurance %BB% Limitation: Do not use =.*)= inside the pattern, e.g. =$pattern(.*foo(.*)bar.*)= does not work, but =$pattern(.*foo(.*?)bar.*)= does %BB% Note: Make sure that the integrity of a web page is not compromised; for example, if you include an HTML table make sure to include everything including the table end tag | 988| =$n= or =$n()= | New line | 989d96 1 990a96 1 991 <td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Sandbox/IncorrectDllVersionW32PTH10DLL">IncorrectDllVersionW32PTH10DLL</a> </td><td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Sandbox/OsWin">OsWin</a> </td><td> 95/98 </td></tr> 992d98 2 993a99 2 994 <td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Sandbox/WinDoze95Crash">WinDoze95Crash</a> </td> 995 <td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Sandbox/OsWin">OsWin</a> </td> 996d184 1 997a184 1 998<form action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%"> 999d186 1 1000a186 2 1001<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" /> 1002<input type="submit" value="Search" /> 1003d194 1 1004a194 1 1005<form action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%"> 1006d196 1 1007a196 2 1008<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" /> 1009<input type="submit" value="Search" /> 1010d201 1 1011a201 1 1012-- TWiki:Main.PeterThoeny - 26 Jul 2004 1013@ 1014 1015 10161.14 1017log 1018@none 1019@ 1020text 1021@d1 1 1022a1 1 1023%META:TOPICINFO{author="PeterThoeny" date="1084053269" format="1.0" version="1.14"}% 1024d9 1 1025a9 1 1026The =%<nop>SEARCH{...}%= variable documented in TWikiVariables has a fixed format for the search result, that is, a table consisting of topic names and topic summaries. Use the =format="..."= parameter to specify a customized format of the search result. The string of the format parameter is typically a bullet list or table row containing variables (such as =%<nop>SEARCH{ "food" format="| $topic | $summary |" }%=). 1027d32 2 1028d52 1 1029a52 1 1030| =$pattern(reg-exp)= | A regular expression pattern to extract some text from a topic (does not search meta data; use =$formfield= instead). In case of a =multiple="on"= search, the pattern is applied to the line found in each search hit. The pattern must cover the whole text (topic or line). For example, =$pattern(.*?\*.*?Email\:\s*([^\n\r]+).*)= extracts the email address from a bullet of format =* Email: ...=. This example has non-greedy =.*?= patterns to scan for the first occurance of the Email bullet; use greedy =.*= patterns to scan for the last occurance. | 1031a58 2 1032__Note:__ For =$pattern(reg-exp)=, specify a RegularExpression that scans from start to end and contains the text you want to keep in parenthesis, like =$pattern(.*?(from here.*?to here).*)=. You need to make sure that the integrity of a web page is not compromised; for example, if you include a table make sure to include everything including the table end tag. 1033 1034d77 1 1035a77 1 1036*Write this in the Know web:* 1037d82 1 1038a82 1 1039*To get this:* 1040d90 1 1041a90 1 1042 <td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Know/IncorrectDllVersionW32PTH10DLL">IncorrectDllVersionW32PTH10DLL</a> </td><td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Know/OsWin">OsWin</a> </td><td> 95/98 </td></tr> 1043d92 2 1044a93 2 1045 <td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Know/WinDoze95Crash">WinDoze95Crash</a> </td> 1046 <td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Know/OsWin">OsWin</a> </td> 1047d133 2 1048d197 1 1049a197 1 1050-- TWiki:Main.PeterThoeny - 16 Mar 2004 1051@ 1052 1053 10541.13 1055log 1056@none 1057@ 1058text 1059@d1 1 1060a1 1 1061%META:TOPICINFO{author="PeterThoeny" date="1079506500" format="1.0" version="1.13"}% 1062d3 194 1063a196 167 1064%TOC% 1065%STARTINCLUDE% 1066---# TWiki Formatted Search Results 1067 1068_Inline search feature allows flexible formatting of search result_ 1069 1070The =%<nop>SEARCH{...}%= variable documented in TWikiVariables has a fixed format for the search result, that is, a table consisting of topic names and topic summaries. Use the =format="..."= parameter to specify a customized format of the search result. The string of the format parameter is typically a bullet list or table row containing variables (such as =%<nop>SEARCH{ "food" format="| $topic | $summary |" }%=). 1071 1072---++ Syntax 1073 1074Two parameters can be used to specify a customized search result: 1075 10761. =header="..."= parameter 1077 1078Use the header parameter to specify the header of a search result. It should correspond to the format of the format parameter. This parameter is optional. <br /> Example: =header="| <nop>*Topic:*<nop> | <nop>*Summary:*<nop> |"= 1079 10802. =format="..."= parameter 1081 1082Use the format parameter to specify the format of one search hit. 1083<br /> Example: =format="| $topic | $summary |"= 1084 1085Variables that can be used in the format string: 1086 1087| *Name:* | *Expands To:* | 1088| =$web= | Name of the web | 1089| =$topic= | Topic name | 1090| =$topic(20)= | Topic name, "<tt>- </tt>" hyphenated each 20 characters | 1091| =$topic(30, -<br />)= | Topic name, hyphenated each 30 characters with separator "<tt>-<br /></tt>" | 1092| =$topic(40, ...)= | Topic name, shortended to 40 characters with "<tt>...</tt>" indication | 1093| =$text= | Formatted topic text. In case of a =multiple="on"= search, it is the line found for each search hit. | 1094| =$locked= | LOCKED flag (if any) | 1095| =$date= | Time stamp of last topic update, e.g. =%GMTIME{"$day $mon $year - $hour:$min"}%= | 1096| =$isodate= | Time stamp of last topic update, e.g. =%GMTIME{"$year-$mo-$dayT$hour:$minZ"}%= | 1097| =$rev= | Number of last topic revision, e.g. =1.4= | 1098| =$username= | Login name of last topic update, e.g. =jsmith= | 1099| =$wikiname= | Wiki user name of last topic update, e.g. =<nop>JohnSmith= | 1100| =$wikiusername= | Wiki user name of last topic update, like =%MAINWEB%.<nop>JohnSmith= | 1101| =$createdate= | Time stamp of topic revision 1.1 | 1102| =$createusername= | Login name of topic revision 1.1, e.g. =jsmith= | 1103| =$createwikiname= | Wiki user name of topic revision 1.1, e.g. =<nop>JohnSmith= | 1104| =$createwikiusername= | Wiki user name of topic revision 1.1, e.g. =%MAINWEB%.<nop>JohnSmith= | 1105| =$summary= | Topic summary | 1106| =$formname= | The name of the form attached to the topic; empty if none | 1107| =$formfield(name)= | The field value of a form field; for example, =$formfield(<nop>TopicClassification)= would get expanded to =PublicFAQ=. This applies only to topics that have a [[TWikiForms][TWikiForm]] | 1108| =$formfield(name, 10)= | Form field value, "<tt>- </tt>" hyphenated each 10 characters | 1109| =$formfield(name, 20, -<br />)= | Form field value, hyphenated each 20 characters with separator "<tt>-<br /></tt>" | 1110| =$formfield(name, 30, ...)= | Form field value, shortended to 30 characters with "<tt>...</tt>" indication | 1111| =$pattern(reg-exp)= | A regular expression pattern to extract some text from a topic (does not search meta data; use =$formfield= instead). In case of a =multiple="on"= search, the pattern is applied to the line found in each search hit. The pattern must cover the whole text (topic or line). For example, =$pattern(.*?\*.*?Email\:\s*([^\n\r]+).*)= extracts the email address from a bullet of format =* Email: ...=. This example has non-greedy =.*?= patterns to scan for the first occurance of the Email bullet; use greedy =.*= patterns to scan for the last occurance. | 1112| =$n= or =$n()= | New line | 1113| =$nop= or =$nop()= | Is a "no operation". This variable gets removed; useful for nested search | 1114| =$quot= | Double quote (="=). Alternatively write =\"= to escape it | 1115| =$percnt= | Percent sign (=%=) | 1116| =$dollar= | Dollar sign (=$=) | 1117 1118__Note:__ For =$pattern(reg-exp)=, specify a RegularExpression that scans from start to end and contains the text you want to keep in parenthesis, like =$pattern(.*?(from here.*?to here).*)=. You need to make sure that the integrity of a web page is not compromised; for example, if you include a table make sure to include everything including the table end tag. 1119 1120 1121---++ Examples 1122 1123 1124#SearchBulletList 1125---+++ Bullet list showing topic name and summary 1126 1127*Write this:* 1128 1129=%<nop>SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * <nop>*Topic: Summary:*" format=" * [<nop>[$topic]]: $summary" }%= 1130 1131*To get this:* 1132 1133%SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * *Topic: Summary:*" format=" * [[$topic]]: $summary" }% 1134 1135 1136---+++ Table showing form field values of topics with a form 1137 1138*Write this in the Know web:* 1139 1140=| <nop>*Topic:*<nop> | <nop>*<nop>OperatingSystem:*<nop> | <nop>*<nop>OsVersion:*<nop> |= <br /> 1141=%<nop>SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" regex="on" nosearch="on" nototal="on" format="| [<nop>[$topic]] | $formfield(<nop>OperatingSystem) | $formfield(<nop>OsVersion) |" }%= 1142 1143*To get this:* 1144 1145<table border="1" cellspacing="0" cellpadding="1"> 1146<tr> 1147 <th bgcolor="#99CCCC"> <strong>Topic:</strong> </th> 1148 <th bgcolor="#99CCCC"> <strong>OperatingSystem:</strong> </th> 1149 <th bgcolor="#99CCCC"> <strong>OsVersion:</strong> </th></tr> 1150<tr> 1151 <td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Know/IncorrectDllVersionW32PTH10DLL">IncorrectDllVersionW32PTH10DLL</a> </td><td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Know/OsWin">OsWin</a> </td><td> 95/98 </td></tr> 1152<tr> 1153 <td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Know/WinDoze95Crash">WinDoze95Crash</a> </td> 1154 <td> <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/Know/OsWin">OsWin</a> </td> 1155 <td> 95 </td></tr> 1156</table> 1157 1158 1159---+++ Extract some text from a topic using regular expression 1160 1161*Write this:* 1162 1163=%<nop>SEARCH{ "__Back to\:__ <nop>TWikiFAQ" scope="text" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [<nop>[$topic][Answer...]]" }%= 1164 1165*To get this:* 1166 1167%SEARCH{ "__Back to\:__ TWikiFAQ" scope="text" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" }% 1168 1169 1170---+++ Nested Search 1171 1172Search can be nested. For example, search for some topics, then form a new search for each topic found in the first search. The idea is to build the nested search string using a formatted search in the first search. 1173 1174Here is an example. Let's search for all topics that contain the word "culture" (first search), and let's find out where each topic found is linked from (second search). 1175 1176 * First search: 1177 * =%<nop>SEARCH{ "culture" format=" * $topic is referenced by: (list all references)" nosearch="on" nototal="on" }%= 1178 * Second search. For each hit we want this search: 1179 * =%<nop>SEARCH{ "(topic found in first search)" format="$topic" nosearch="on" nototal="on" separator=", " }%= 1180 * Now let's nest the two. We need to escape the second search, e.g. the first search will build a valid second search string. Note that we escape the second search so that it does not get evaluated prematurely by the first search: 1181 * Use =$percnt= to escape the leading percent of the second search 1182 * Use =\"= to escape the double quotes 1183 * Use =$dollar= to escape the =$= of =$topic= 1184 * Use =$nop= to escape the =}%= sequence 1185 1186*Write this:* 1187 1188=%<nop>SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" nosearch="on" nototal="on" }%= 1189 1190*To get this:* 1191 1192%SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" nosearch="on" nototal="on" }% 1193 1194---+++ Most recently changed pages 1195 1196*Write this:* 1197 1198=%<nop>SEARCH{ "\.*" scope="topic" regex="on" nosearch="on" nototal="on" order="modified" reverse="on" format="| [<nop>[$topic]] | $wikiusername | $date |" limit="7" }%= 1199 1200*To get this:* 1201 1202%SEARCH{ "\.*" scope="topic" regex="on" nosearch="on" nototal="on" order="modified" reverse="on" format="| [[$topic]] | $wikiusername | $date |" limit="7" }% 1203 1204---+++ Embedding search forms to return a formatted result 1205 1206Use an HTML form and an embedded formatted search on the same topic. You can link them together with an =%<nop>URLPARAM{"..."}%= variable. Example: 1207 1208*Write this:* 1209 1210<verbatim> 1211<form action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%"> 1212Find Topics: 1213<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" /> 1214<input type="submit" value="Search" /> 1215</form> 1216Result: 1217%SEARCH{ search="%URLPARAM{"q"}%" format=" * $web.$topic: %BR% $summary" nosearch="on" }% 1218</verbatim> 1219 1220*To get this:* 1221 1222<form action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%"> 1223Find Topics: 1224<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" /> 1225<input type="submit" value="Search" /> 1226</form> 1227Result: 1228%SEARCH{ search="%URLPARAM{"q"}%" format=" * $web.$topic: %BR% $summary" nosearch="on" }% 1229 1230-- TWiki:Main.PeterThoeny - 16 Mar 2004 1231@ 1232 1233 12341.12 1235log 1236@none 1237@ 1238text 1239@d1 1 1240a1 1 1241%META:TOPICINFO{author="PeterThoeny" date="1071560368" format="1.0" version="1.12"}% 1242d27 1 1243a27 1 1244| =$web= | Name of the web(s), separated by commas, or 'all' | 1245d34 5 1246a38 5 1247| =$date= | Time stamp of last topic update, like =%GMTIME{"$day $mon $year - $hour:$min"}%= | 1248| =$isodate= | Time stamp of last topic update, like =%GMTIME{"$year-$mo-$dayT$hour:$minZ"}%= | 1249| =$rev= | Number of last topic revision, like =1.4= | 1250| =$username= | Login name of last topic update, like =jsmith= | 1251| =$wikiname= | Wiki user name of last topic update, like =<nop>JohnSmith= | 1252d40 4 1253d45 1 1254d50 1 1255a50 1 1256| =$pattern(reg-exp)= | A regular expression pattern to extract some text from a topic. In case of a =multiple="on"= search, the pattern is applied to the line found in each search hit. For example, =$pattern(.*?\*.*?Email\:\s*([^\n\r]+).*)= extracts the email address from a bullet of format =* Email: ...=. | 1257d118 1 1258a118 1 1259 * =%<nop>SEARCH{ "(topic found in first search)" format=" $topic" nosearch="on" nototal="on" }%= 1260d127 1 1261a127 1 1262=%<nop>SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\" $dollartopic\" nosearch=\"on\" nototal=\"on\" }$nop%" nosearch="on" nototal="on" }%= 1263d131 1 1264a131 1 1265%SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\" $dollartopic\" nosearch=\"on\" nototal=\"on\" }$nop%" nosearch="on" nototal="on" }% 1266d143 27 1267a169 1 1268-- TWiki:Main.PeterThoeny - 15 Dec 2003 1269@ 1270 1271 12721.11 1273log 1274@none 1275@ 1276text 1277@d1 1 1278a1 1 1279%META:TOPICINFO{author="PeterThoeny" date="1064795573" format="1.0" version="1.11"}% 1280d27 1 1281a27 1 1282| =$web= | Name of the web | 1283d128 1 1284d130 9 1285a138 1 1286-- Main.PeterThoeny - 16 May 2002 1287@ 1288 1289 12901.10 1291log 1292@none 1293@ 1294text 1295@d1 1 1296a1 1 1297%META:TOPICINFO{author="PeterThoeny" date="1062998687" format="1.0" version="1.10"}% 1298d32 1 1299a32 1 1300| =$text= | Formatted topic text | 1301d45 1 1302a45 1 1303| =$pattern(reg-exp)= | A regular expression pattern to extract some text from a topic. For example, =$pattern(.*?\*.*?Email\:\s*([^\n\r]+).*)= extracts the email address from a bullet of format =* Email: ...=. | 1304@ 1305 1306 13071.9 1308log 1309@none 1310@ 1311text 1312@d1 1 1313a1 1 1314%META:TOPICINFO{author="PeterThoeny" date="1029257204" format="1.0" version="1.9"}% 1315d37 2 1316a39 1 1317| =$username= | User name of last topic update, like =<nop>JohnSmith= | 1318@ 1319 1320 13211.8 1322log 1323@none 1324@ 1325text 1326@d1 1 1327a1 1 1328%META:TOPICINFO{author="PeterThoeny" date="1021618648" format="1.0" version="1.8"}% 1329d17 1 1330a17 1 1331Use the header paramter to specify the header of a search result. It should correspond to the format of the format parameter. This parameter is optional. <br /> Example: =header="| <nop>*Topic:*<nop> | <nop>*Summary:*<nop> |"= 1332@ 1333 1334 13351.7 1336log 1337@none 1338@ 1339text 1340@d1 1 1341a1 1 1342%META:TOPICINFO{author="PeterThoeny" date="1019270220" format="1.0" version="1.7"}% 1343a52 1 1344---++ Nested Search 1345d54 1 1346a54 17 1347Search can be nested. For example, search for some topics, then form a new search for each topic found in the first search. The idea is to build the nested search string using a formatted search in the first search. 1348 1349Here is an example. We want to search for topics, do a nested search with each hit, and show the result as nested bullets. Parameters like =scope="text" regex="on" nosearch="on" nototal="on"= are omitted for simplicity. 1350 1351 * First search: 1352 * =%<nop>SEARCH{ "freedom" format=" * $topic" }%= 1353 * Second search. For each hit we want this search: 1354 * =%<nop>SEARCH{ "(topic of first search)" format=" * $topic" }%= 1355 * Now we nest the searches. We need to escape the second search, e.g. the first search will build a valid second search string: 1356 * =%<nop>SEARCH{ "freedom" format=" * $topic: $n$percntSEARCH{ \"$topic\" format=\" * $dollartopic" }$nop%\" }%= 1357 1358Note that we escape the second search so that it does not get evaluated by the first search: 1359 1360 * =$percnt= to escape the leading percent of the second search 1361 * =\"= to escape the qouble quotes 1362 * =$dollar= to escape the =$= of =$topic= 1363 * =$nop= to escape the =}%= sequence 1364a56 2 1365---++ Examples 1366 1367d60 1 1368a60 1 1369Write this: 1370d64 1 1371a64 1 1372To get this: 1373d68 1 1374d71 1 1375a71 1 1376Write this in the Know web: 1377d76 1 1378a76 1 1379To get this: 1380d91 1 1381d94 1 1382a94 1 1383Write this: 1384d98 1 1385a98 1 1386To get this: 1387d101 26 1388@ 1389 1390 13911.6 1392log 1393@none 1394@ 1395text 1396@d1 1 1397a1 1 1398%META:TOPICINFO{author="PeterThoeny" date="1014013365" format="1.0" version="1.6"}% 1399a8 2 1400---++ Overview 1401 1402d13 1 1403a13 1 1404Two paramters can be used to specify a customized search result: 1405d17 1 1406a17 1 1407Use the header paramter to specify the header of a search result. It should correspond to the format of the format parameter. This parameter is optional. I.e. <br /> =header="| <nop>*Topic:*<nop> | <nop>*Summary:*<nop> |"= 1408d21 2 1409a22 1 1410Use the format paramter to specify the format of one search hit. I.e. <br /> =format="| $topic | $summary |"= 1411a26 1 1412| =$n= | New line | 1413d29 3 1414d34 5 1415a38 5 1416| =$date= | Time stamp of last topic update, i.e. =%GMTIME{"$day $mon $year - $hour:$min"}%= | 1417| =$isodate= | Time stamp of last topic update, i.e. =%GMTIME{"$year-$mo-$dayT$hour:$minZ"}%= | 1418| =$rev= | Number of last topic revision, i.e. =1.4= | 1419| =$wikiusername= | Wiki user name of last topic update, i.e. =%MAINWEB%.<nop>JohnSmith= | 1420| =$username= | User name of last topic update, i.e. =<nop>JohnSmith= | 1421d40 32 1422a71 2 1423| =$formfield(name)= | The field value of a form field, i.e. =$formfield(<nop>TopicClassification)= would get expanded to =PublicFAQ=. This applies only to topics that have a [[TWikiForms][TWikiForm]] | 1424| =$pattern(reg-exp)= | A regular expression pattern to extract some text from a topic, i.e. =$pattern(.*?\*.*?Email\:\s*([^\n\r]+).*)= extracts the email address from a bullet of format =* Email: ...=. | 1425a72 1 1426__Note:__ For =$pattern(reg-exp)=, specify a RegularExpression that scans from start to end and contains the text you want to keep in parenthesis, i.e. =$pattern(.*?(from here.*?to here).*)=. You need to make sure that the integrity of a web page is not compromised, i.e. if you include a table make sure to include everything including the table end tag. 1427d76 1 1428d119 1 1429a119 1 1430-- Main.PeterThoeny - 28 Nov 2001 <br /> 1431@ 1432 1433 14341.5 1435log 1436@none 1437@ 1438text 1439@d1 1 1440a1 1 1441%META:TOPICINFO{author="PeterThoeny" date="1013886793" format="1.0" version="1.5"}% 1442d31 1 1443a31 1 1444| =$topictext= | Formatted topic text | 1445@ 1446 1447 14481.4 1449log 1450@none 1451@ 1452text 1453@d1 1 1454a1 1 1455%META:TOPICINFO{author="PeterThoeny" date="1011075257" format="1.0" version="1.4"}% 1456d31 1 1457@ 1458 1459 14601.3 1461log 1462@none 1463@ 1464text 1465@d1 1 1466a1 1 1467%META:TOPICINFO{author="MikeMannix" date="1007296400" format="1.0" version="1.3"}% 1468d11 1 1469a11 1 1470By default, the format for displaying a search result is fixed, e.g. a table with rows of topic name and topic summary. Use the =format="..."= parameter to specify a customized format of the search result. The string of the format parameter is typically a bullet list or table row containing variables (i.e. =%<nop>SEARCH{ "food" format="| $topic | $summary |" }%=). 1471@ 1472 1473 14741.2 1475log 1476@none 1477@ 1478text 1479@d1 1 1480a1 1 1481%META:TOPICINFO{author="PeterThoeny" date="1007018373" format="1.0" version="1.2"}% 1482d3 3 1483a5 1 1484*Formatted Search Using ==%<nop>SEARCH{... format="..."}%== Variable* 1485d7 1 1486a7 1 1487%TOC% 1488d9 1 1489a9 1 1490---++ Preface 1491@ 1492 1493 14941.1 1495log 1496@none 1497@ 1498text 1499@d1 1 1500a1 1 1501%META:TOPICINFO{author="PeterThoeny" date="1003975981" format="1.0" version="1.1"}% 1502d17 1 1503a17 1 1504Use the header paramter to specify the header of a search result. It should correspond to the format of the format parameter. This parameter is optional. I.e. =header="| <nop>*Topic:*<nop> | <nop>*Summary:*<nop> |"= 1505d21 1 1506a21 1 1507Use the format paramter to specify the format of one search hit. I.e. =format="| $topic | $summary |"= 1508d26 1 1509d30 2 1510a31 1 1511| =$date= | Time stamp of last topic update | 1512d34 1 1513d36 1 1514a36 1 1515| =$formfield(name)= | The field value of a form field, i.e. =$formfield(TopicClassification)= would get expanded to =PublicFAQ=. This applies only to topics that have a [[TWikiForms][TWikiForm]] | 1516d58 1 1517a58 1 1518=%<nop>SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" regex="on" nosearch="on" nototal="on" format="| [<nop>[$topic]] | $formfield(OperatingSystem) | $formfield(OsVersion) |" }%= 1519d85 1 1520a85 1 1521-- Main.PeterThoeny - 24 Oct 2001 <br /> 1522@ 1523