I have a model that looks like this
class Message(db.Model):
content = db.Column(JSON)
I want to perform a search on that field which contain some JSON fields
normally when I something like this it works
Message.query.filter(Message.content['summary'].cast(Unicode).match(search_term))
Now I want to use or another field if the field summary doesn't exist or is empty
using either with or without casting fails with programming error of types needs to be boolean
Message.query.filter(Message.content['summary'] | Message.content['text+video'].match(search_term))