zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
U
¸ý°dnã@s„ddlmZddlmZddlmZddlmZddlmZddlmZddlm    Z    ddlm
Z
dd    l m Z Gd
d „d e
ej ƒZd S) é)Úexc)Úutil)Ú    coercions)Úelements)Ú    operators)Úroles)Ú _generative)Ú
Generative)ÚSelfcs^eZdZdZdZdZ‡fdd„Zeedœdd„ƒZ    eedœd    d
„ƒZ
eedœd d „ƒZ ‡Z S) Úmatcha[Produce a ``MATCH (X, Y) AGAINST ('TEXT')`` clause.
 
    E.g.::
 
        from sqlalchemy import desc
        from sqlalchemy.dialects.mysql import match
 
        match_expr = match(
            users_table.c.firstname,
            users_table.c.lastname,
            against="Firstname Lastname",
        )
 
        stmt = (
            select(users_table)
            .where(match_expr.in_boolean_mode())
            .order_by(desc(match_expr))
        )
 
    Would produce SQL resembling::
 
        SELECT id, firstname, lastname
        FROM user
        WHERE MATCH(firstname, lastname) AGAINST (:param_1 IN BOOLEAN MODE)
        ORDER BY MATCH(firstname, lastname) AGAINST (:param_2) DESC
 
    The :func:`_mysql.match` function is a standalone version of the
    :meth:`_sql.ColumnElement.match` method available on all
    SQL expressions, as when :meth:`_expression.ColumnElement.match` is
    used, but allows to pass multiple columns
 
    :param cols: column expressions to match against
 
    :param against: expression to be compared towards
 
    :param in_boolean_mode: boolean, set "boolean mode" to true
 
    :param in_natural_language_mode: boolean , set "natural language" to true
 
    :param with_query_expansion: boolean, set "query expansion" to true
 
    .. versionadded:: 1.4.19
 
    .. seealso::
 
        :meth:`_expression.ColumnElement.match`
 
    Z mysql_matchTcs®|st d¡‚| dd¡}|dkr,t d¡‚t tj|¡}tjj    t
j |d}d|_ t  | dd¡| dd¡| dd¡d    œ¡}|r”t d
d  |¡¡‚tƒj||t
j|d dS) Nzcolumns are requiredÚagainstzagainst is required)ZclausesFÚin_boolean_modeÚin_natural_language_modeÚwith_query_expansion)Úmysql_boolean_modeÚmysql_natural_languageÚmysql_query_expansionzunknown arguments: %sz, )Ú    modifiers)rÚ ArgumentErrorÚpoprÚexpectrZExpressionElementRolerZBooleanClauseListZ_construct_rawrZcomma_opÚgrouprZ immutabledictÚjoinÚsuperÚ__init__Zmatch_op)ÚselfÚcolsÚkwr ÚleftÚflags©Ú    __class__©ú[d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/dialects/mysql/expression.pyrJs4
 
þþ
ÿ
ûÿ
zmatch.__init__)ÚreturncCs|j ddi¡|_|S)z¢Apply the "IN BOOLEAN MODE" modifier to the MATCH expression.
 
        :return: a new :class:`_mysql.match` instance with modifications
         applied.
        rT©rÚunion©rr"r"r#r lszmatch.in_boolean_modecCs|j ddi¡|_|S)z³Apply the "IN NATURAL LANGUAGE MODE" modifier to the MATCH
        expression.
 
        :return: a new :class:`_mysql.match` instance with modifications
         applied.
        rTr%r'r"r"r#rws    zmatch.in_natural_language_modecCs|j ddi¡|_|S)z§Apply the "WITH QUERY EXPANSION" modifier to the MATCH expression.
 
        :return: a new :class:`_mysql.match` instance with modifications
         applied.
        rTr%r'r"r"r#rƒszmatch.with_query_expansion) Ú__name__Ú
__module__Ú __qualname__Ú__doc__Z__visit_name__Z inherit_cacherrr
r rrÚ __classcell__r"r"r r#r s1 "
 r N)ÚrrZsqlrrrrZsql.baserr    Z util.typingr
ZBinaryExpressionr r"r"r"r#Ú<module>    s