The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XAO::DO::Web::Search - XAO::Web Database Search

SYNOPSIS

Useful in XAO::Web site context.

DESCRIPTION

OBSOLETE, TO BE REMOVED. Use <%FS mode='search' ...%> instead.

Accepts the following arguments:

db_list or db_class => '/Customers'

Database (object) name (path). If 'db_list' is used, a normal search is performed. If 'db_class' is used, a collection search is performed

index_1..N => 'first_name|last_name'

Name of database field(s) to perform search on. Multiple field names are separated by | (pipe character) and treated as a logical 'or'.

value_1..N => 'Ann|Lonnie'

Keywords you want to search for in field(s) of corresponding index. Multiple sets of keywords are separated by | (pipe character) and treated as a logical 'or'.

compare_1..N => 'ws'

Comparison operator to be used in matching index to value. Supported comparison operators are: eq True if equal.

    ge  True if greater or equal.

    gt  True if greater.

    le  True if less or equal.

    lt  True if less.

    ne  True if not equal.

    gtlt True if greater than             'a' and less than 'b'

    gtle True if greater than             'a' and less than or equal to 'b'

    gelt True if greater than or equal to 'a' and less than             'b'

    gele True if greater than or equal to 'a' and less than or equal to 'b'

    wq  (word equal)True if contains given word completely.

    ws  (word start) True if contains word that starts with the given string.

    cs  (contains string) True if contains string.
expression => [ [ 1 and 2 ] and [ 3 or 4] ]

Logical expression, as shown above, that indicates how to combine index/value pairs. Numbers are used to indicate expressions specified by corresponding index/value pairs and brackets are used so that only one logical operator (and, or) is contained within a pair of brackets.

orderby => '+last_name|-first_name'

Optional field to use for sorting output. If field name is preceded by - (minus sign), sorting will be done in descending order for that field, otherwise it will be done in ascending order. For consistency and clarity, a + (plus sign) may precede a field name to expicitly indicate sorting in ascending order. Multiple fields to sort by are separated by | (pipe character) and are listed in order of priority.

distinct => 'first_name'

This eliminates duplicate matches on a given field, just like SQL distinct.

start_item => 40

Number indicating the first query match to fetch.

items_per_page => 20

Number indicating the maximum number of query matches to fetch.

Example:

 <%Search db_list="/Customers"

          index_1="first_name|last_name"
          value_1="Linda|Mary Ann|Steven"
          compare_1="wq"

          index_2="gender"
          value_2="female"
          compare_2="wq"

          index_3="age"
          value_3="21|30"
          compare_3="gelt"

          expression="[ [ 1 and 2 ] and 3 ]"
          orderby="age|first_name+desc"
          start_item="40"
          items_per_page="20"
 %>

SUPPORTED CONFIGURATION VALUES

default_search_args

The value of this configuration value is a reference to a hash. In this hash each key is a database (object) path (name) whose corresponding value is a reference to a hash containing the default arguments for searching on the specified of data. These default arguments are added unless they are specified by input arguments.

METHODS

No publicly available methods except overriden display().

EXPORTS

Nothing.

AUTHOR

Copyright (c) 2003-2005 Andrew Maltsev

Copyright (c) 2001-2003 Marcos Alves, XAO Inc.

<am@ejelta.com> -- http://ejelta.com/xao/

SEE ALSO

Recommended reading: XAO::Web.