1 <a name="VarSEARCH"></a>
3 ### <a name="SEARCH{"text"} -- search content"></a> SEARCH\{"text"\} -- search content
5 - Inline search, shows a search result embedded in a topic
6 - Syntax: `%SEARCH{"text" ...}%`
7 - Supported parameters: <table border="1" cellpadding="0" cellspacing="0">
9 <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
10 <th bgcolor="#99CCCC"><strong> Description: </strong></th>
11 <th bgcolor="#99CCCC"><strong> Default: </strong></th>
14 <td><code>"text"</code></td>
15 <td> Search term. Is a keyword search, literal search, regular expression search, or query, depending on the <code>type</code> parameter. [[Main/SearchHelp]] has more </td>
19 <td><code>search="text"</code></td>
20 <td> (Alternative to above) </td>
24 <td><code>web="Name"</code><br /><code>web="%USERSWEB%, Know"</code><br /><code>web="all"</code></td>
25 <td> Comma-separated list of webs to search. You can specifically <strong>exclude</strong> webs from an <code>all</code> search using a minus sign - for example, <code>web="all,-Secretweb"</code>. The special word <code>all</code> means all webs that do <strong>not</strong> have the <code>NOSEARCHALL</code> variable set to <code>on</code> in their [[Main/WebPreferences]]. Note that [[Main/TWikiAccessControls]] are respected when searching webs; it is <strong>much</strong> better to use them than <code>NOSEARCHALL</code>. </td>
26 <td> Current web </td>
29 <td><code>topic="WebPreferences"</code><br /><code>topic="*Bug"</code></td>
30 <td> Limit search to topics: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. <strong><em>Note</em></strong> this is a list of <strong>topic names</strong> and must <strong>not</strong> include web names. </td>
31 <td> All topics in a web </td>
34 <td><code>excludetopic="Web*"</code><br /><code>excludetopic="WebHome, WebChanges"</code></td>
35 <td> Exclude topics from search: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. <strong><em>Note</em></strong> this is a list of <strong>topic names</strong> and must <strong>not</strong> include web names. </td>
39 <td><code>scope="topic"</code><br /><code>scope="text"</code><br /><code>scope="all"</code></td>
40 <td> Search topic name (title); the text (body) of topic; or all (title and body) </td>
41 <td><code>"text"</code></td>
44 <td><code>type="keyword"</code><br /><code>type="word"</code><br /><code>type="literal"</code><br /><code>type="regex"</code><br /><code>type="query"</code></td>
45 <td> Control how the search is performed when <code>scope="text"</code> or <code>scope="all"</code><hr /><code>keyword</code>: use Google-like controls as in <code>soap "web service" -shampoo</code>; searches word parts: using the example, topics with "soapsuds" will be found as well, but topics with "shampoos" will be excluded <hr /><code>word</code>: identical to <code>keyword</code> but searches whole words: topics with "soapsuds" will not be found, and topics with "shampoos" will not be excluded <hr /><code>literal</code>: search for the exact string, like <code>web service</code><hr /><code>regex</code>: use a [[Main/RegularExpression]] search like <code>soap;web service;!shampoo</code>; to search on whole words use <code>\bsoap\b</code><hr /><code>query</code>: [[Main/QuerySearch]] of form fields and other meta-data, like <code>(Firstname='Emma' OR Firstname='John') AND Lastname='Peel'</code></td>
46 <td><code>%SEARCHVAR- DEFAULTTYPE%</code> [[Main/TWikiPreferences]] setting (%SEARCHVARDEFAULTTYPE%) </td>
49 <td><code>order="topic"</code><br /><code>order="created"</code><br /><code>order="modified"</code><br /><code>order="editby"</code><br /><code>order=<br /> "formfield(name)"</code></td>
50 <td> Sort the results of search by the topic names, topic creation time, last modified time, last editor, or named field of [[Main/TWikiForms]]. The sorting is done web by web; if you want to sort across webs, create a [[Main/FormattedSearch]] table and sort it with [[Main/TablePlugin]]'s initsort. Note that dates are sorted most recent date <strong>last</strong> (i.e at the bottom of the table). </td>
51 <td> Sort by topic name </td>
54 <td><code>limit="all"</code><br /><code>limit="16"</code></td>
55 <td> Limit the number of results returned. This is done after sorting if <code>order</code> is specified </td>
56 <td> All results </td>
59 <td><code>date="..."</code></td>
60 <td> limits the results to those pages with latest edit time in the given [[Main/TimeSpecifications#TimeIntervals]]. </td>
61 <td> All results </td>
64 <td><code>reverse="on"</code></td>
65 <td> Reverse the direction of the search </td>
66 <td> Ascending search </td>
69 <td><code>casesensitive="on"</code></td>
70 <td> Case sensitive search </td>
71 <td> Ignore case </td>
74 <td><code>bookview="on"</code></td>
75 <td>[[Main/BookView]] search, e.g. show complete topic text </td>
76 <td> Show topic summary </td>
79 <td><code>nonoise="on"</code></td>
80 <td> Shorthand for <code>nosummary="on" nosearch="on" nototal="on" zeroresults="off" noheader="on" noempty="on"</code></td>
84 <td><code>nosummary="on"</code></td>
85 <td> Show topic title only </td>
86 <td> Show topic summary </td>
89 <td><code>nosearch="on"</code></td>
90 <td> Suppress search string </td>
91 <td> Show search string </td>
94 <td><code>noheader="on"</code></td>
95 <td> Suppress default search header <br /><span style="background: #FFB0B0"> <strong>Topics: Changed: By:</strong> </span>, unless a <code>header</code> is explicitly specified </td>
96 <td> Show default search header, unless search is inline and a format is specified (Cairo compatibility) </td>
99 <td><code>nototal="on"</code></td>
100 <td> Do not show number of topics found </td>
101 <td> Show number </td>
104 <td><code>zeroresults="off"</code></td>
105 <td> Suppress all output if there are no hits </td>
106 <td><code>zeroresults="on"</code>, displays: "Number of topics: 0" </td>
109 <td><code>noempty="on"</code></td>
110 <td> Suppress results for webs that have no hits. </td>
111 <td> Show webs with no hits </td>
114 <td><code>header="..."</code><br /><code>format="..."</code></td>
115 <td> Custom format results: see <strong>[[Main/FormattedSearch]]</strong> for usage, variables & examples </td>
116 <td> Results in table </td>
119 <td><code>expandvariables="on"</code></td>
120 <td> Expand variables before applying a [[Main/FormattedSearch]] on a search hit. Useful to show the expanded text, e.g. to show the result of a [[Main/SpreadSheetPlugin]] <code>%CALC{}%</code> instead of the formula </td>
124 <td><code>multiple="on"</code></td>
125 <td> Multiple hits per topic. Each hit can be [[Main/FormattedSearch]]. The last token is used in case of a regular expression ";" <em>and</em> search </td>
126 <td> Only one hit per topic </td>
129 <td><code>nofinalnewline="on"</code></td>
130 <td> If <code>on</code>, the search variable does not end in a line by itself. Any text continuing immediately after the search variable on the same line will be rendered as part of the table generated by the search, if appropriate. </td>
131 <td><code>off</code></td>
134 <td><code>recurse="on"</code></td>
135 <td> Recurse into subwebs, if subwebs are enabled. </td>
136 <td><code>off</code></td>
139 <td><code>separator=", "</code></td>
140 <td> Line separator <em>between</em> search hits </td>
141 <td><code>"$n"</code> (Newline) </td>
144 <td><code>newline="%BR%"</code></td>
145 <td> Line separator <em>within</em> a search hit. Useful if the format="" parameter contains a $pattern() that captures more than one line, i.e. contents of a textfield in a form. </td>
146 <td><code>"$n"</code> (Newline) </td>
149 - Example: `%SEARCH{"wiki" web="%USERSWEB%" scope="topic"}%`
150 - Example with format: `%SEARCH{"FAQ" scope="topic" nosearch="on" nototal="on" header="| *Topic: * | *Summary: * |" format="| $topic | $summary |"}%` _(displays results in a table with header - [[details|Main/FormattedSearch]])_
151 - %H% Hint: If the TWiki:Plugins.TablePlugin is installed, you may set a `%TABLE{}%` variable just before the `%SEARCH{}%` to alter the output of a search. Example: `%TABLE{ tablewidth="90%" }%`
152 - Related: [[METASEARCH|Main/VarMETASEARCH]], [[TOPICLIST|Main/VarTOPICLIST]], [[WEBLIST|Main/VarWEBLIST]], [[FormattedSearch]], [[QuerySearch]], [[SearchHelp]], [[SearchPatternCookbook]], [[RegularExpression]]