data/TWiki/TWikiSearchDotPm.txt
changeset 0 414e01d06fd5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/data/TWiki/TWikiSearchDotPm.txt	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,70 @@
     1.4 +---+ Package =TWiki::Search=
     1.5 +
     1.6 +This module implements all the search functionality.
     1.7 +
     1.8 +
     1.9 +%TOC%
    1.10 +
    1.11 +---++ ClassMethod *new* <tt>($session)</tt>
    1.12 +
    1.13 +Constructor for the singleton Search engine object.
    1.14 +
    1.15 +
    1.16 +
    1.17 +---++ ObjectMethod *finish* <tt>()</tt>
    1.18 +Break circular references.
    1.19 +
    1.20 +
    1.21 +
    1.22 +---++ StaticMethod *getTextPattern* <tt>($text,$pattern)</tt>
    1.23 +
    1.24 +Sanitise search pattern - currently used for FormattedSearch only
    1.25 +
    1.26 +
    1.27 +
    1.28 +---++ ObjectMethod *searchWeb* <tt>(...)</tt>
    1.29 +
    1.30 +Search one or more webs according to the parameters.
    1.31 +
    1.32 +If =_callback= is set, that means the caller wants results as
    1.33 +soon as they are ready. =_callback_ should be set to a reference
    1.34 +to a function which takes =_cbdata= as the first parameter and
    1.35 +remaining parameters the same as 'print'.
    1.36 +
    1.37 +If =_callback= is set, the result is always undef. Otherwise the
    1.38 +result is a string containing the rendered search results.
    1.39 +
    1.40 +If =inline= is set, then the results are *not* decorated with
    1.41 +the search template head and tail blocks.
    1.42 +
    1.43 +The function will throw Error::Simple if it encounters any problems with the
    1.44 +syntax of the search string.
    1.45 +
    1.46 +Note: If =format= is set, =template= will be ignored.
    1.47 +
    1.48 +Note: For legacy, if =regex= is defined, it will force type='regex'
    1.49 +
    1.50 +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.
    1.51 +
    1.52 +SMELL: If =template= is defined =bookview= will not work
    1.53 +
    1.54 +SMELL: it seems that if you define =_callback= or =inline= then you are
    1.55 +	responsible for converting the TML to HTML yourself!
    1.56 +	
    1.57 +FIXME: =callback= cannot work with format parameter (consider format='| $topic |'
    1.58 +
    1.59 +
    1.60 +
    1.61 +---++ StaticMethod *displayFormField* <tt>($meta,$args) -> $text</tt>
    1.62 +
    1.63 +Parse the arguments to a $formfield specification and extract
    1.64 +the relevant formfield from the given meta data.
    1.65 +
    1.66 +   * =args= string containing name of form field
    1.67 +
    1.68 +In addition to the name of a field =args= can be appended with a commas
    1.69 +followed by a string format (\d+)([,\s*]\.\.\.)?). This supports the formatted
    1.70 +search function $formfield and is used to shorten the returned string or a 
    1.71 +hyphenated string.
    1.72 +
    1.73 +