I have MySQL table with full-text index. I want to know how to use MATCH … AGAINST() with SQLAlchemy. Do you have some examples?
...
trs = dbsession.query(Trans).filter(Trans.client_id==user_id)
if search and search != '':
trs = trs.filter(or_(Trans.transcribe.like('%'+search+'%'), Trans.lang_name.like('%'+search+'%')))
...
I want to replace LIKE with ‘MATCH/AGAINST IN BOOLEAN MODE’ construction but I don’t know how
You should simply need to use the clause:
where
str_to_matchis the string you want to match.This compiles (for the MySQL dialects) to (assuming the
Transmodel table name istransand the model attributes match the column names):