def _search(self, query, search_term):
    (op, term) = parse_like_term(search_term)
    criteria = None
    for field in self._search_fields:
        flt = {('%s__%s' % (field.name, op)): term}
        q = mongoengine.Q(**flt)
        if (criteria is None):
            criteria = q
        else:
            criteria |= q
    return query.filter(criteria)
def _search(self, query, search_term):
    (op, term) = parse_like_term(search_term)
    criteria = None
    for field in self._search_fields:
        flt = {('%s__%s' % (field.name, op)): term}
        q = mongoengine.Q(**flt)
        if (criteria is None):
            criteria = q
        else:
            criteria |= q
    return query.filter(criteria)