I am working on python with postgres database ,i have two tables which have many to many relation and third table in which relations are saved , i need to apply flask-msearch on relations table in a way that it fetches & search in both tables and give the resultant output , I have implemented on single table it is working fine there but not working in many to many relation
Here is my model which is working correctly
class JobpostJobpost(db.Model):
__tablename__ = 'jobpost_jobpost'
__searchable__ = ['company_name']
id = db.Column('job_id', Integer, primary_key=True)
company_name = db.Column(String(255))
& to search i have to use this query
JobpostJobpost.query.msearch(query,fields=['company_name'])
it gives accurate result but when i use it for multi table it gives error here i my code of model for multitable
class TblDegreeSpecilizationRelation(db.Model): __tablename__ = 'tbl_degree_specilization_relation' __searchable__ = ['tbl_suggestion_degrees.name','tbl_suggestion_degrees.tags'] # ,'tbl_suggestion_degree_specilization.name' ,'tbl_suggestion_degree_specilization.tags' id = db.Column('id', Integer, nullable=False, primary_key=True) degree_id = db.Column('degree_id', ForeignKey(u'tbl_suggestion_degrees.id', ondelete=u'CASCADE')) specilization_id = db.Column('specilization_id', ForeignKey(u'tbl_suggestion_degree_specilization.id', ondelete=u'CASCADE'))