XAO::DO::Web::Search - XAO::Web Database Search
Useful in XAO::Web site context.
Accepts the following arguments:
Database (object) name (path). If 'db_list' is used, a normal search is performed. If 'db_class' is used, a collection search is performed
Name of database field(s) to perform search on. Multiple field names are separated by | (pipe character) and treated as a logical 'or'.
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'.
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.
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.
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.
This eliminates duplicate matches on a given field, just like SQL distinct.
Number indicating the first query match to fetch.
Number indicating the maximum number of query matches to fetch.
<%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" %>
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.
No publicly available methods except overriden display().
Copyright (c) 2003-2005 Andrew Maltsev
Copyright (c) 2001-2003 Marcos Alves, XAO Inc.
<email@example.com> -- http://ejelta.com/xao/
Recommended reading: XAO::Web.