internal methods for complex_search

The filter to convert a complex-search-form to a proper searchterm for the searchengine is placed in the templateengine as standard function. The searchengine itself can only deal with searchterms.

For easier programming of complex-search the templateengine provides the following methods for the programmer. Note that these functions are not available in the template but only inside the programming of functions for the template-engine.

Methods

num is always the first parameter. Its the number of the cgi-field we want to process. Every method gets the value of the cgi-field complexNUM by itself by readin $var->{cgi}->{param}->{complexNUM}.

$t is always the last parameter (see below at the variables-section). The results of the methods will be stored in the appropriate substructure of $t

In ffc() there is an optional parameter $fds AFTER $t that allows very complex virtual fields.

ffc

process the input of a field/operator/value-combination

parameters: num, $t, [$fds]

num is the number of the field-field, num+1 is the operator-field and num+2 is the value-field
the operator-field has the following allowed values

i  .. is
n  .. is not
e .. equal (for numerical values and dates)
g  .. greater
k  .. smaller
a  .. greater or equal
b  .. smaller or equal

$fds allows mapping of fieldnames and databases. If a search should search more than one sql-fields under one complex-searchfield, then the following syntax applies:

my $fds={D=>[':DN,DA']};

In case you have virtual fields, that cross different databases as well, you can use:

my $fds={S=>['-ZA:D,P,O','-ZT:B','-UF:D'],
   A=>['-ZA:A','-ZT:HG','-UF:A','-WM:A,HG'],
   J=>['-ZA:J','-ZT:LG','-UF:J','-WM:J']};

The exact syntax is like:

$fds={VIRTUAL_FIELD_NAME=>['CML:FML','CML:FML']}

CML is the config_match_list, a comma-seperatedlist of database-shortcuts and FML is the field_match_list, a comma-seperated list of field-shortcuts. If leaving CML empty here be sure to apply a final DB-specificator at the end, cause FML is not allowed without explicitely specifying a CML.

If you want to search different Databases here than specified in your final db-specificator, you need to use the dashed CMLs inside as described in DB-definition in searchsyntax

ffs

process the input of a select-field

parameters: num, fieldname, pattern for ‘noselect’, $t,$fds

fieldname is the shortcut of the field
pattern is a regular expression. If the value of the cgi-form matches this pattern than no searchterm will be added to $t

ffm

process the input of a multiselect-field. Almost identical to ffs()

parameters: num, fieldname, pattern for ‘noselect’, $t

fieldname is the shortcut of the field
pattern is a regular expression. If the value of the cgi-form matches this pattern than no searchterm will be added to $t

ffn

process the input of a select-field which has the structure “ALL/CONDITION/NOT CONDITION” based on a single field in the databse

parameters: num, fieldname, pattern for ‘noselect’, value of condition, value of not-condition, $t

fieldname is the shortcut of the field
pattern is a regular expression. If the value of the cgi-form matches this pattern than no searchterm will be added to $t
condition is the exact lowercased value of the condition

Variables

$t

$t->{a}, $t->{ae}

$t->{n}, $t->{ne}

$t->{l}, $t->{le}

 
kb/templateengine/complex_search.txt · Last modified: 2006/09/29 19:29 by peter