none
[openafs-wiki.git] / TWiki / TWikiUISearchDotPm.mdwn
1 # <a name="Package &lt;code&gt;TWiki::UI::Search="></a> Package =TWiki::UI::Search
2
3 UI functions for searching.
4
5 <div>
6   <ul>
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>
9       </ul>
10     </li>
11   </ul>
12 </div>
13
14 ## <a name="StaticMethod &lt;strong&gt;search&lt;/strong&gt; ($session)"></a> [[StaticMethod]] **search** `($session)`
15
16 Perform a search as dictated by CGI parameters:
17
18 <table border="1" cellpadding="0" cellspacing="0">
19   <tr>
20     <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
21     <th bgcolor="#99CCCC"><strong> Description: </strong></th>
22     <th bgcolor="#99CCCC"><strong> Default: </strong></th>
23   </tr>
24   <tr>
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>
27     <td> required </td>
28   </tr>
29   <tr>
30     <td><code>search="text"</code></td>
31     <td> (Alternative to above) </td>
32     <td> N/A </td>
33   </tr>
34   <tr>
35     <td><code>web="Name"</code><br /><code>web="Main, 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>
38   </tr>
39   <tr>
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>
43   </tr>
44   <tr>
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>
47     <td> None </td>
48   </tr>
49   <tr>
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>
53   </tr>
54   <tr>
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>
58   </tr>
59   <tr>
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>
63   </tr>
64   <tr>
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>
68   </tr>
69   <tr>
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>
73   </tr>
74   <tr>
75     <td><code>reverse="on"</code></td>
76     <td> Reverse the direction of the search </td>
77     <td> Ascending search </td>
78   </tr>
79   <tr>
80     <td><code>casesensitive="on"</code></td>
81     <td> Case sensitive search </td>
82     <td> Ignore case </td>
83   </tr>
84   <tr>
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>
88   </tr>
89   <tr>
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>
92     <td> Off </td>
93   </tr>
94   <tr>
95     <td><code>nosummary="on"</code></td>
96     <td> Show topic title only </td>
97     <td> Show topic summary </td>
98   </tr>
99   <tr>
100     <td><code>nosearch="on"</code></td>
101     <td> Suppress search string </td>
102     <td> Show search string </td>
103   </tr>
104   <tr>
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>
108   </tr>
109   <tr>
110     <td><code>nototal="on"</code></td>
111     <td> Do not show number of topics found </td>
112     <td> Show number </td>
113   </tr>
114   <tr>
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>
118   </tr>
119   <tr>
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>
123   </tr>
124   <tr>
125     <td><code>header="..."</code><br /><code>format="..."</code></td>
126     <td> Custom format results: see <strong>[[Main/FormattedSearch]]</strong> for usage, variables &amp; examples </td>
127     <td> Results in table </td>
128   </tr>
129   <tr>
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>
132     <td> Raw text </td>
133   </tr>
134   <tr>
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>
138   </tr>
139   <tr>
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>
143   </tr>
144   <tr>
145     <td><code>separator=", "</code></td>
146     <td> Line separator between hits </td>
147     <td> Newline <code>"$n"</code></td>
148   </tr>
149 </table>