man Text::Query::BuildSQL () - Base class for SQL query builders

NAME

Text::Query::BuildSQL - Base class for SQL query builders

SYNOPSIS

    package Text::Query::BuildSQLsqldb;

    use Text::Query::BuildSQL;

    use vars qw(@ISA);

    @ISA = qw(Text::Query::BuildSQL);

DESCRIPTION

Defines all the CWbuild_* functions to build a syntax tree. The tree nodes are [ operator scope operand operand... ]. The CWbuild_final_expression function translate the syntax tree in a CWwhere clause using the CWresolve method. If the scope of the search is not specified (simple query or advanced query without scope operator), the scope is set to the list of comma separated fields provided by the CW-fields_searched option. The resulting CWwhere clause is placed in the CWselect order provided with the CW-select option, if any.

SYNTAX TREE

The string enclosed in single quotes must match exactly. The <string> token stands for an arbitrary string. A description enclosed in [something ...] means repeated 0 or N times.

 expr: 'or' scope expr [expr ...]
       'and' scope expr [expr ...]
       'not' scope expr
       'near' scope expr_literal expr_literal
       'forbiden' scope expr_literal [expr_literal ...]
       'mandatory' scope expr_literal [expr_literal ...]
       'optional' scope expr_literal [expr_literal ...]
       'literal' scope <string>

 expr_literal: literal scope <string>

 scope: <string>

METHODS

resolve([], Q1)
Returns a CWwhere clause string corresponding to the CWQ1 syntax tree.
sortplusminus([], Q1)
Translate the CWmandatory and CWforbiden syntactic nodes to their boolean equivalents. If it CWhas_relevance returns false and there is at least one CWmandatory word, the first CWmandatory word is added to the list of CWoptional words.
has_relevance()
Returns true if relevance ranking is possible, false if not. It is used by the CWsortplusminus function. Returns false by default. If relevance ranking is not possible, the semantic of the simple search is slighthly modified. When asking for CW+a b c it shows all the documents containing CWa and (CWb or CWc). The normal behaviour is to return all the documents containing CWa and to sort them to show first those containing (CWb or CWc). When relevance ranking is not available the CWb, CWc search terms are therefore useless. That is why we decided to change the semantic of the query if no relevance ranking is available.

OPTIONS

-select STRING
If provided the string returned by CWbuild_final_expression substitutes the CW__WHERE__ tag with the CWwhere string generated by the CWresolve function. The substituted string is the return value of the CWbuild_final_expression. If not set the return value of the CWbuild_final_expression is the result of the CWresolve function.
-fields_searched FIELDS_LIST
CWFIELDS_LIST is a list of comma separated field names. It is used as the default scope if no scope is provided in the query string. The CWbuild_final_expression function will CWcroak if this option is not provided and no scope operator were used.

SEE ALSO

AUTHORS

Loic Dachary (loic@senga.org)