+++ /dev/null
-<a name="VarSEARCH"></a>
-
-### <a name="SEARCH{"text"} -- search content"></a> SEARCH\{"text"\} -- search content
-
-- Inline search, shows a search result embedded in a topic
-- Syntax: `%SEARCH{"text" ...}%`
-- Supported parameters: <table border="1" cellpadding="0" cellspacing="0">
- <tr>
- <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
- <th bgcolor="#99CCCC"><strong> Description: </strong></th>
- <th bgcolor="#99CCCC"><strong> Default: </strong></th>
- </tr>
- <tr>
- <td><code>"text"</code></td>
- <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>
- <td> required </td>
- </tr>
- <tr>
- <td><code>search="text"</code></td>
- <td> (Alternative to above) </td>
- <td> N/A </td>
- </tr>
- <tr>
- <td><code>web="Name"</code><br /><code>web="%USERSWEB%, Know"</code><br /><code>web="all"</code></td>
- <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>
- <td> Current web </td>
- </tr>
- <tr>
- <td><code>topic="WebPreferences"</code><br /><code>topic="*Bug"</code></td>
- <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>
- <td> All topics in a web </td>
- </tr>
- <tr>
- <td><code>excludetopic="Web*"</code><br /><code>excludetopic="WebHome, WebChanges"</code></td>
- <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>
- <td> None </td>
- </tr>
- <tr>
- <td><code>scope="topic"</code><br /><code>scope="text"</code><br /><code>scope="all"</code></td>
- <td> Search topic name (title); the text (body) of topic; or all (title and body) </td>
- <td><code>"text"</code></td>
- </tr>
- <tr>
- <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>
- <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>
- <td><code>%SEARCHVAR- DEFAULTTYPE%</code> [[Main/TWikiPreferences]] setting (%SEARCHVARDEFAULTTYPE%) </td>
- </tr>
- <tr>
- <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>
- <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>
- <td> Sort by topic name </td>
- </tr>
- <tr>
- <td><code>limit="all"</code><br /><code>limit="16"</code></td>
- <td> Limit the number of results returned. This is done after sorting if <code>order</code> is specified </td>
- <td> All results </td>
- </tr>
- <tr>
- <td><code>date="..."</code></td>
- <td> limits the results to those pages with latest edit time in the given [[Main/TimeSpecifications#TimeIntervals]]. </td>
- <td> All results </td>
- </tr>
- <tr>
- <td><code>reverse="on"</code></td>
- <td> Reverse the direction of the search </td>
- <td> Ascending search </td>
- </tr>
- <tr>
- <td><code>casesensitive="on"</code></td>
- <td> Case sensitive search </td>
- <td> Ignore case </td>
- </tr>
- <tr>
- <td><code>bookview="on"</code></td>
- <td>[[Main/BookView]] search, e.g. show complete topic text </td>
- <td> Show topic summary </td>
- </tr>
- <tr>
- <td><code>nonoise="on"</code></td>
- <td> Shorthand for <code>nosummary="on" nosearch="on" nototal="on" zeroresults="off" noheader="on" noempty="on"</code></td>
- <td> Off </td>
- </tr>
- <tr>
- <td><code>nosummary="on"</code></td>
- <td> Show topic title only </td>
- <td> Show topic summary </td>
- </tr>
- <tr>
- <td><code>nosearch="on"</code></td>
- <td> Suppress search string </td>
- <td> Show search string </td>
- </tr>
- <tr>
- <td><code>noheader="on"</code></td>
- <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>
- <td> Show default search header, unless search is inline and a format is specified (Cairo compatibility) </td>
- </tr>
- <tr>
- <td><code>nototal="on"</code></td>
- <td> Do not show number of topics found </td>
- <td> Show number </td>
- </tr>
- <tr>
- <td><code>zeroresults="off"</code></td>
- <td> Suppress all output if there are no hits </td>
- <td><code>zeroresults="on"</code>, displays: "Number of topics: 0" </td>
- </tr>
- <tr>
- <td><code>noempty="on"</code></td>
- <td> Suppress results for webs that have no hits. </td>
- <td> Show webs with no hits </td>
- </tr>
- <tr>
- <td><code>header="..."</code><br /><code>format="..."</code><br /><code>footer="..."</code></td>
- <td> Custom format results: see <strong>[[Main/FormattedSearch]]</strong> for usage, variables & examples </td>
- <td> Results in table </td>
- </tr>
- <tr>
- <td><code>expandvariables="on"</code></td>
- <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>
- <td> Raw text </td>
- </tr>
- <tr>
- <td><code>multiple="on"</code></td>
- <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>
- <td> Only one hit per topic </td>
- </tr>
- <tr>
- <td><code>nofinalnewline="on"</code></td>
- <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>
- <td><code>off</code></td>
- </tr>
- <tr>
- <td><code>recurse="on"</code></td>
- <td> Recurse into subwebs, if subwebs are enabled. </td>
- <td><code>off</code></td>
- </tr>
- <tr>
- <td><code>separator=", "</code></td>
- <td> Line separator <em>between</em> search hits </td>
- <td><code>"$n"</code> (Newline) </td>
- </tr>
- <tr>
- <td><code>newline="%BR%"</code></td>
- <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>
- <td><code>"$n"</code> (Newline) </td>
- </tr>
-</table>
-- Example: `%SEARCH{"wiki" web="%USERSWEB%" scope="topic"}%`
-- 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]])_
-- %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%" }%`
-- Related: [[METASEARCH|Main/VarMETASEARCH]], [[TOPICLIST|Main/VarTOPICLIST]], [[WEBLIST|Main/VarWEBLIST]], [[FormattedSearch]], [[QuerySearch]], [[SearchHelp]], [[SearchPatternCookbook]], [[RegularExpression]]