data/TWiki/TWikiSearchDotPm.txt
author Colas Nahaboo <colas@nahaboo.net>
Mon, 11 Aug 2008 20:33:37 +0200
changeset 2 7bc60a767fa4
parent 0 414e01d06fd5
permissions -rw-r--r--
TWiki-4.2.2 Release
     1 ---+ Package =TWiki::Search=
     2 
     3 This module implements all the search functionality.
     4 
     5 
     6 %TOC%
     7 
     8 ---++ ClassMethod *new* <tt>($session)</tt>
     9 
    10 Constructor for the singleton Search engine object.
    11 
    12 
    13 
    14 ---++ ObjectMethod *finish* <tt>()</tt>
    15 Break circular references.
    16 
    17 
    18 
    19 ---++ StaticMethod *getTextPattern* <tt>($text,$pattern)</tt>
    20 
    21 Sanitise search pattern - currently used for FormattedSearch only
    22 
    23 
    24 
    25 ---++ ObjectMethod *searchWeb* <tt>(...)</tt>
    26 
    27 Search one or more webs according to the parameters.
    28 
    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'.
    33 
    34 If =_callback= is set, the result is always undef. Otherwise the
    35 result is a string containing the rendered search results.
    36 
    37 If =inline= is set, then the results are *not* decorated with
    38 the search template head and tail blocks.
    39 
    40 The function will throw Error::Simple if it encounters any problems with the
    41 syntax of the search string.
    42 
    43 Note: If =format= is set, =template= will be ignored.
    44 
    45 Note: For legacy, if =regex= is defined, it will force type='regex'
    46 
    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.
    48 
    49 SMELL: If =template= is defined =bookview= will not work
    50 
    51 SMELL: it seems that if you define =_callback= or =inline= then you are
    52 	responsible for converting the TML to HTML yourself!
    53 	
    54 FIXME: =callback= cannot work with format parameter (consider format='| $topic |'
    55 
    56 
    57 
    58 ---++ StaticMethod *displayFormField* <tt>($meta,$args) -> $text</tt>
    59 
    60 Parse the arguments to a $formfield specification and extract
    61 the relevant formfield from the given meta data.
    62 
    63    * =args= string containing name of form field
    64 
    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 
    68 hyphenated string.
    69 
    70