D
D
dolgachev2017-04-20 12:47:04
Flask
dolgachev, 2017-04-20 12:47:04

How to do full text search in peewee (MySQL)?

Hello colleagues!
There are following data models in peewee

# Таблица организационно-правовых форм (olfs)
class Olfs(BaseModel):
    name = CharField()


# Таблицы юридических лиц нашей организации (entityes)
class Entityes(BaseModel):
    name = CharField()
    requisites = TextField()
    olf = ForeignKeyField(Olfs, related_name='entity_olf')


# Таблица контрагентов (contractors)
class Contractors(BaseModel):
    name = CharField()
    requisites = TextField()
    olf = ForeignKeyField(Olfs, related_name='contractor_olf')


# Таблица contracts, содержит договоры
class Contracts(BaseModel):
    number = CharField()
    enter_date = DateField()
    subject = TextField()
    contractor = ForeignKeyField(Contractors, related_name='contractor')
    entity = ForeignKeyField(Entityes, related_name='entity')


There is the following selection:
contracts = (Contracts.select(Contracts, Contractors, Entityes)
                .join(Contractors)
                .switch(Contracts)
                .join(Entityes))


How to make full-text search in all fields of this selection?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question