<<O>> Difference Topic FormattedSearch (r1.2 - 29 Nov 2001 - PeterThoeny?) |
Changed: | |||||
< < |
Use 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="| *Topic:* | *Summary:* |"
| ||||
> > |
Use 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="| *Topic:* | *Summary:* |"
| ||||
Changed: | |||||
< < |
Use the format paramter to specify the format of one search hit. I.e. format="| $topic | $summary |"
| ||||
> > |
Use the format paramter to specify the format of one search hit. I.e. format="| $topic | $summary |"
| ||||
Added: | |||||
> > |
| ||||
Changed: | |||||
< < |
| ||||
> > |
| ||||
Added: | |||||
> > |
| ||||
Changed: | |||||
< < |
| ||||
> > |
| ||||
Changed: | |||||
< < |
%SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" regex="on" nosearch="on" nototal="on" format="| [[$topic]] | $formfield(OperatingSystem?) | $formfield(OsVersion?) |" }%
| ||||
> > |
%SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" regex="on" nosearch="on" nototal="on" format="| [[$topic]] | $formfield(OperatingSystem) | $formfield(OsVersion) |" }%
| ||||
Changed: | |||||
< < |
-- PeterThoeny? - 24 Oct 2001 | ||||
> > |
-- PeterThoeny? - 28 Nov 2001 |
<<O>> Difference Topic FormattedSearch (r1.1 - 25 Oct 2001 - PeterThoeny?) |
Added: | ||||||||||||||||||||||||||||||
> > |
%META:TOPICINFO{author="PeterThoeny" date="1003975981" format="1.0" version="1.1"}%
%META:TOPICPARENT{name="TWikiVariables"}%
Formatted Search Using %SEARCH{... format="..."}% Variable
PrefaceBy default, the format for displaying a search result is fixed, e.g. a table with rows of topic name and topic summary. Use theformat="..." 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. %SEARCH{ "food" format="| $topic | $summary |" }% ).
SyntaxTwo paramters can be used to specify a customized search result: 1.header="..." parameter
Use 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="| *Topic:* | *Summary:* |"
2. format="..." parameter
Use the format paramter to specify the format of one search hit. I.e. format="| $topic | $summary |"
Variables that can be used in the format string:
$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.
ExamplesBullet list showing topic name and summaryWrite this:%SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * *Topic: Summary:*" format=" * [[$topic]]: $summary" }%
To get this:
Table showing form field values of topics with a formWrite this in the Know web:| *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:
Extract some text from a topic using regular expressionWrite this:%SEARCH{ "__Back to\:__ TWikiFAQ" scope="text" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" }%
To get this:
TWiki FAQs:
|
Topic FormattedSearch . { View | Diffs | r1.3 | > | r1.2 | > | r1.1 | More } |
Revision r1.1 - 25 Oct 2001 - 02:13 GMT - PeterThoeny? Revision r1.2 - 29 Nov 2001 - 07:02 GMT - PeterThoeny? |
This website is distributed under the GNU Documentation License |