|
TOC: No TOC in "TWiki.FormattedSearch"
|
|
Inline search feature allows flexible formatting of search result
|
< < |
The %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 %SEARCH{ "food" format="| $topic | $summary |" }% ).
|
> > |
The %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 %SEARCH{ "food" format="| $topic | $summary |" }% ).
|
|
Syntax
|
|
$topic(20) | Topic name, "- " hyphenated each 20 characters |
$topic(30, -<br />) | Topic name, hyphenated each 30 characters with separator "-<br />" |
$topic(40, ...) | Topic name, shortended to 40 characters with "..." indication |
|
> > |
$parent | Name of parent topic; empty if not set |
$parent(20) | Name of parent topic, same hyphenation/shortening like $topic() |
|
|
$text | Formatted topic text. In case of a multiple="on" search, it is the line found for each search hit. |
$locked | LOCKED flag (if any) |
$date | Time stamp of last topic update, e.g. 05 Nov 2024 - 21:27 |
|
|
$formfield(name, 10) | Form field value, "- " hyphenated each 10 characters |
$formfield(name, 20, -<br />) | Form field value, hyphenated each 20 characters with separator "-<br />" |
$formfield(name, 30, ...) | Form field value, shortended to 30 characters with "..." indication |
|
< < |
$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. |
|
> > |
$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. • Specify a RegularExpression that covers the whole text (topic or line), which typically starts with .* , and must end in .* • Put text you want to keep in parenthesis, like $pattern(.*?(from here.*?to here).*) • 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 • Limitation: Do not use .*) inside the pattern, e.g. $pattern(.*foo(.*)bar.*) does not work, but $pattern(.*foo(.*?)bar.*) does • 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 |
|
|
$n or $n() | New line |
$nop or $nop() | Is a "no operation". This variable gets removed; useful for nested search |
$quot | Double quote (" ). Alternatively write \" to escape it |
$percnt | Percent sign (% ) |
$dollar | Dollar sign ($ ) |
|
< < |
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.
|
|
Examples
|
|
Table showing form field values of topics with a form
|
< < |
Write this in the Know web:
|
> > |
In a web where there is a form that contains a TopicClassification field, an OperatingSystem field and an OsVersion field we could write:
|
|
| *Topic:* | *OperatingSystem:* | *OsVersion:* |
%SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" regex="on" nosearch="on" nototal="on" format="| [[$topic]] | $formfield(OperatingSystem) | $formfield(OsVersion) |" }%
|
< < |
To get this:
|
> > |
To get this:
|
|
|
|
OperatingSystem: |
OsVersion: |
|
< < |
|
> > |
|
|
|
< < |
|
> > |
|
|
|
|
- ATasteOfTWiki is referenced by:
- FormattedSearch is referenced by:
- EditTablePlugin, EmptyPlugin, ManagingWebs, RenderListPlugin, SearchHelp, SpreadSheetPlugin, TWikiDocumentation, TWikiForms, TWikiFuncModule, TWikiHistory, TWikiMetaData, TWikiUpgradeTo01Dec2001, TWikiUpgradeTo01Feb2003, TWikiVariablesNtoZ, TextFormattingRules, WebHome, WelcomeGuest
- TWikiAccessControl is referenced by:
- CommentPlugin, EditTablePlugin, FileAttachment, MainFeatures, ManagingTopics, ManagingUsers, TWikiAccessControl, TWikiDocumentation, TWikiForms, TWikiFuncModule, TWikiHistory, TWikiPreferences, TWikiTopics, TWikiTutorial, TWikiUpgradeTo01Dec2000, TWikiUpgradeTo01Dec2001, TWikiUserAuthentication, TWikiVariables, WebHome, WebPreferences, WelcomeGuest, WikiCulture, WikiWord
- TWikiSite is referenced by:
- AdminTools, InstantEnhancements, InterwikiPlugin, ManagingWebs, StartingPoints, TWikiDocumentation, TWikiGlossary, TWikiInstallationGuide, TWikiPreferences, TWikiRegistrationPub, TWikiSite, TWikiSiteTools, TWikiTopics, TWikiTutorial, TWikiUpgradeTo01Dec2000, WabiSabi, WebChangesAlert, WebHome, WebSiteTools, WelcomeGuest, WhatIsWikiWiki, WikiCulture, WikiReferences
- WabiSabi is referenced by:
- WelcomeGuest is referenced by:
- ATasteOfTWiki, NewUserTemplate, StartingPoints, TWikiSite, TWikiUpgradeTo01Dec2000, WebHome, WebLeftBar, WebPreferences, WhatIsWikiWiki, WikiCulture, YouAreHere
- WikiCulture is referenced by:
|
> > |
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.
|
|
Most recently changed pages
Write this:
|
|
Result:
Number of topics: 0
|
< < |
-- TWiki:Main.PeterThoeny - 16 Mar 2004
|
> > |
-- TWiki:Main.PeterThoeny - 26 Jul 2004
|
|
|