gddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm Z dd l m Z Gd d e ejZy ) )exc)util) coercions)elements) operators)roles) _generative) Generative)SelfcleZdZdZdZdZfdZedefdZ edefdZ edefdZ xZ S) matchasProduce 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: .. sourcecode:: sql 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` mysql_matchTc`|stjd|jdd}|tjdtjt j |}tjjtj|}d|_ tj|jdd|jdd|jddd }|r'tjd d j|zt |E||tj$| y) Nzcolumns are requiredagainstzagainst is required)clausesFin_boolean_modein_natural_language_modewith_query_expansion)mysql_boolean_modemysql_natural_languagemysql_query_expansionzunknown arguments: %sz, ) modifiers)r ArgumentErrorpoprexpectrExpressionElementRolerBooleanClauseList_construct_rawrcomma_opgroupr immutabledictjoinsuper__init__match_op)selfcolskwrleftflags __class__s U/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/dialects/mysql/expression.pyr$zmatch.__init__Ms##$:; ;&&D) ?##$9: :""  ' '   ))88   9  ""&(ff->&F*,&&.+*,0F)N    ##$;tyy}$MN N w (:(:eLreturncJ|jjddi|_|S)zApply the "IN BOOLEAN MODE" modifier to the MATCH expression. :return: a new :class:`_mysql.match` instance with modifications applied. rTrunionr&s r,rzmatch.in_boolean_modeos%--/CT.JK r-cJ|jjddi|_|S)zApply the "IN NATURAL LANGUAGE MODE" modifier to the MATCH expression. :return: a new :class:`_mysql.match` instance with modifications applied. rTr0r2s r,rzmatch.in_natural_language_modezs%--/G.NO r-cJ|jjddi|_|S)zApply the "WITH QUERY EXPANSION" modifier to the MATCH expression. :return: a new :class:`_mysql.match` instance with modifications applied. rTr0r2s r,rzmatch.with_query_expansions%--/F.MN r-) __name__ __module__ __qualname____doc____visit_name__ inherit_cacher$r r rrr __classcell__)r+s@r,r r sm1f#NM MD $  dr-r N)rrsqlrrrrsql.baser r util.typingr BinaryExpressionr r-r,rBs8#"zJ11zr-