none
[openafs-wiki.git] / TWiki / TWikiSearchDotPm.mdwn
1 # <a name="Package &lt;code&gt;TWiki::Search="></a> Package =TWiki::Search
2
3 This module implements all the search functionality.
4
5 <div>
6   <ul>
7     <li><a href="#Package =TWiki::Search="> Package TWiki::Search</a><ul>
8         <li><a href="#ClassMethod <strong>new</strong> ($session)"> ClassMethod new <tt>($session)</tt></a></li>
9         <li><a href="#StaticMethod <strong>get_TextPattern</strong> ("> StaticMethod getTextPattern <tt>($text,$pattern)</tt></a></li>
10         <li><a href="#ObjectMethod <strong>searchWeb</strong> (...)"> ObjectMethod searchWeb <tt>(...)</tt></a></li>
11       </ul>
12     </li>
13   </ul>
14 </div>
15
16 ## <a name="ClassMethod &lt;strong&gt;new&lt;/strong&gt; ($session)"></a> [[ClassMethod]] **new** `($session)`
17
18 Constructor for the singleton Search engine object.
19
20 ## <a name="StaticMethod &lt;strong&gt;get_TextPattern&lt;/strong&gt; ("></a> [[StaticMethod]] **getTextPattern** `($text,$pattern)`
21
22 Sanitise search pattern - currently used for [[FormattedSearch]] only
23
24 ## <a name="ObjectMethod &lt;strong&gt;searchWeb&lt;/strong&gt; (...)"></a> [[ObjectMethod]] **searchWeb** `(...)`
25
26 Search one or more webs according to the parameters.
27
28 If `_callback` is set, that means the caller wants results as soon as they are ready. =\_callback\_ should be set to a reference to a function which takes `_cbdata` as the first parameter and remaining parameters the same as 'print'.
29
30 If `_callback` is set, the result is always undef. Otherwise the result is a string containing the rendered search results.
31
32 If `inline` is set, then the results are **not** decorated with the search template head and tail blocks.
33
34 Note: If `format` is set, `template` will be ignored.
35
36 Note: For legacy, if `regex` is defined, it will force type='regex'
37
38 SMELL: If `template` is defined `bookview` will not work
39
40 SMELL: it seems that if you define `_callback` or `inline` then you are responsible for converting the TML to HTML yourself!
41
42 FIXME: `callback` cannot work with format parameter (consider format='| $topic |'