1 # <a name="Package <code>TWiki::UI::Search="></a> Package =TWiki::UI::Search
3 UI functions for searching.
7 <li><a href="#Package =TWiki::UI::Search="> Package TWiki::UI::Search</a><ul>
8 <li><a href="#StaticMethod <strong>search</strong> ($session)"> StaticMethod search <tt>($session)</tt></a></li>
14 ## <a name="StaticMethod <strong>search</strong> ($session)"></a> [[StaticMethod]] **search** `($session)`
16 Perform a search as dictated by CGI parameters:
18 <table border="1" cellpadding="0" cellspacing="0">
20 <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
21 <th bgcolor="#99CCCC"><strong> Description: </strong></th>
22 <th bgcolor="#99CCCC"><strong> Default: </strong></th>
25 <td><code>"text"</code></td>
26 <td> Search term. Is a keyword search, literal search or regular expression search, depending on the <code>type</code> parameter. [[Main/SearchHelp]] has more </td>
30 <td><code>search="text"</code></td>
31 <td> (Alternative to above) </td>
35 <td><code>web="Name"</code><br /><code>web="%USERSWEB%, Know"</code><br /><code>web="all"</code></td>
36 <td> Comma-separated list of webs to search. The special word <code>all</code> means all webs that doe <strong>not</strong> have the <code>NOSEARCHALL</code> variable set to <code>on</code> in their [[Main/WebPreferences]]. You can specifically <strong>exclude</strong> webs from an <code>all</code> search using a minus sign - for example, <code>web="all,-Secretweb"</code>. </td>
37 <td> Current web </td>
40 <td><code>topic="WebPreferences"</code><br /><code>topic="*Bug"</code></td>
41 <td> Limit search to topics: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. </td>
42 <td> All topics in a web </td>
45 <td><code>excludetopic="Web*"</code><br /><code>excludetopic="WebHome, WebChanges"</code></td>
46 <td> Exclude topics from search: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. </td>
50 <td><code>type="keyword"</code><br /><code>type="literal"</code><br /><code>type="regex"</code></td>
51 <td> Do a keyword search like <code>soap "web service" -shampoo</code>; a literal search like <code>web service</code>; or [[Main/RegularExpression]] search like <code>soap;web service;!shampoo</code></td>
52 <td><code>%SEARCHVAR- DEFAULTTYPE%</code> [[Main/TWikiPreferences]] setting (%SEARCHVARDEFAULTTYPE%) </td>
55 <td><code>scope="topic"</code><br /><code>scope="text"</code><br /><code>scope="all"</code></td>
56 <td> Search topic name (title); the text (body) of topic; or all (both) </td>
57 <td><code>"text"</code></td>
60 <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>
61 <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; in case you want to sort across webs, create a [[Main/FormattedSearch]] table and sort it with [[Main/TablePlugin]]'s initsort </td>
62 <td> Sort by topic name </td>
65 <td><code>limit="all"</code><br /><code>limit="16"</code></td>
66 <td> Limit the number of results returned. This is done after sorting if <code>order</code> is specified </td>
67 <td> All results </td>
70 <td><code>date="..."</code></td>
71 <td> limits the results to those pages with latest edit time in the given [[Main/TimeInterval]]. </td>
72 <td> All results </td>
75 <td><code>reverse="on"</code></td>
76 <td> Reverse the direction of the search </td>
77 <td> Ascending search </td>
80 <td><code>casesensitive="on"</code></td>
81 <td> Case sensitive search </td>
82 <td> Ignore case </td>
85 <td><code>bookview="on"</code></td>
86 <td>[[Main/BookView]] search, e.g. show complete topic text </td>
87 <td> Show topic summary </td>
90 <td><code>nonoise="on"</code></td>
91 <td> Shorthand for <code>nosummary="on" nosearch="on" nototal="on" zeroresults="off" noheader="on" noempty="on"</code></td>
95 <td><code>nosummary="on"</code></td>
96 <td> Show topic title only </td>
97 <td> Show topic summary </td>
100 <td><code>nosearch="on"</code></td>
101 <td> Suppress search string </td>
102 <td> Show search string </td>
105 <td><code>noheader="on"</code></td>
106 <td> Suppress search header <br /><span style="background: #FFB0B0"> <strong>Topics: Changed: By:</strong> </span></td>
107 <td> Show search header </td>
110 <td><code>nototal="on"</code></td>
111 <td> Do not show number of topics found </td>
112 <td> Show number </td>
115 <td><code>zeroresults="off"</code></td>
116 <td> Suppress all output if there are no hits </td>
117 <td><code>zeroresults="on"</code>, displays: "Number of topics: 0" </td>
120 <td><code>noempty="on"</code></td>
121 <td> Suppress results for webs that have no hits. </td>
122 <td> Show webs with no hits </td>
125 <td><code>header="..."</code><br /><code>format="..."</code></td>
126 <td> Custom format results: see <strong>[[Main/FormattedSearch]]</strong> for usage, variables & examples </td>
127 <td> Results in table </td>
130 <td><code>expandvariables="on"</code></td>
131 <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>
135 <td><code>multiple="on"</code></td>
136 <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>
137 <td> Only one hit per topic </td>
140 <td><code>nofinalnewline="on"</code></td>
141 <td> If <code>on</code>, the search variable does not end in a line by itself. Any text continuing immediately after the search tag on the same line will be rendered as part of the table generated by the search, if appropriate. </td>
142 <td><code>off</code></td>
145 <td><code>separator=", "</code></td>
146 <td> Line separator between hits </td>
147 <td> Newline <code>"$n"</code></td>