def METHOD_NAME(self, db_session, search_query, offset=0, limit=40):
    # We need to get the next limit + offset terms if we want to
    # offset results from the db.
    g_msgids = self._search(search_query, limit=limit + offset)
    if not g_msgids:
        return []
    query = (
        db_session.query(Thread)
        .join(Message, Message.thread_id == Thread.id)
        .filter(
            Thread.namespace_id == self.account.namespace.id,
            Thread.deleted_at.is_(None),
            Message.namespace_id == self.account.namespace.id,
            Message.g_msgid.in_(g_msgids),
        )
        .order_by(desc(Message.received_date))
    )
    if offset:
        query = query.offset(offset)
    if limit:
        query = query.limit(limit)
    return query.all()