1 ---+ Package =TWiki::Search=
3 This module implements all the search functionality.
8 ---++ ClassMethod *new* <tt>($session)</tt>
10 Constructor for the singleton Search engine object.
14 ---++ ObjectMethod *finish* <tt>()</tt>
15 Break circular references.
19 ---++ StaticMethod *getTextPattern* <tt>($text,$pattern)</tt>
21 Sanitise search pattern - currently used for FormattedSearch only
25 ---++ ObjectMethod *searchWeb* <tt>(...)</tt>
27 Search one or more webs according to the parameters.
29 If =_callback= is set, that means the caller wants results as
30 soon as they are ready. =_callback_ should be set to a reference
31 to a function which takes =_cbdata= as the first parameter and
32 remaining parameters the same as 'print'.
34 If =_callback= is set, the result is always undef. Otherwise the
35 result is a string containing the rendered search results.
37 If =inline= is set, then the results are *not* decorated with
38 the search template head and tail blocks.
40 The function will throw Error::Simple if it encounters any problems with the
41 syntax of the search string.
43 Note: If =format= is set, =template= will be ignored.
45 Note: For legacy, if =regex= is defined, it will force type='regex'
47 If =type="word"= it will be changed to =type="keyword"= with =wordBoundaries=1=. This will be used for searching with scope="text" only, because scope="topic" will do a Perl search on topic names.
49 SMELL: If =template= is defined =bookview= will not work
51 SMELL: it seems that if you define =_callback= or =inline= then you are
52 responsible for converting the TML to HTML yourself!
54 FIXME: =callback= cannot work with format parameter (consider format='| $topic |'
58 ---++ StaticMethod *displayFormField* <tt>($meta,$args) -> $text</tt>
60 Parse the arguments to a $formfield specification and extract
61 the relevant formfield from the given meta data.
63 * =args= string containing name of form field
65 In addition to the name of a field =args= can be appended with a commas
66 followed by a string format (\d+)([,\s*]\.\.\.)?). This supports the formatted
67 search function $formfield and is used to shorten the returned string or a