def search_criterion(self):
        q = request.GET['__q'] if '__q' in request.GET else None
        criterion = self.__model__._real_id > 0
        if self.__model__ is not None and q is not None:
            q_parts = q.replace('-',' ').replace('_',' ').replace('/',' ').split(' ')
            model_obj = self.__model__()
            column_names = model_obj._column_list
            for q in q_parts:
                tmp_criterion = self.__model__._real_id < 0 # False
                for column_name in column_names:
                    prop = getattr(self.__model__, column_name)
                    if model_obj._get_relation_names() in column_name:
                        ref_metadata = model_obj._get_relation_metadata(column_name)
                        ref_class = model_obj._get_relation_class(column_name)
                        ref_obj = ref_class()
                        sub_column_names = ref_obj._column_list
                        for sub_column_name in sub_column_names:
                            # only applied to actual column
                            if sub_column_name in ref_obj._get_actual_column_names():
                                sub_column = getattr(ref_class, sub_column_name)
                                if ref_metadata.uselist:
                                    # one to many
                                    tmp_criterion = or_(tmp_criterion, prop.any(sub_column.ilike(q + '%')))
                                    tmp_criterion = or_(tmp_criterion, prop.any(sub_column.ilike('% '+q+'%')))
                                    tmp_criterion = or_(tmp_criterion, prop.any(sub_column.ilike('%-'+q+'%')))
                                    tmp_criterion = or_(tmp_criterion, prop.any(sub_column.ilike('%/'+q+'%')))
                                    tmp_criterion = or_(tmp_criterion, prop.any(sub_column.ilike('%|_'+q+'%', escape='|')))
                                else:
                                    # many to one
                                    tmp_criterion = or_(tmp_criterion, prop.has(sub_column.ilike(q + '%')))
                                    tmp_criterion = or_(tmp_criterion, prop.has(sub_column.ilike('% '+q+'%')))
                                    tmp_criterion = or_(tmp_criterion, prop.has(sub_column.ilike('%-'+q+'%')))
                                    tmp_criterion = or_(tmp_criterion, prop.has(sub_column.ilike('%/'+q+'%')))
                                    tmp_criterion = or_(tmp_criterion, prop.has(sub_column.ilike('%|_'+q+'%', escape='|')))
                    elif column_name in model_obj._get_actual_column_names():
                        tmp_criterion = or_(tmp_criterion, prop.ilike(q + '%'))
                        tmp_criterion = or_(tmp_criterion, prop.ilike('% '+q+'%'))
                        tmp_criterion = or_(tmp_criterion, prop.ilike('%-'+q+'%'))
                        tmp_criterion = or_(tmp_criterion, prop.ilike('%/'+q+'%'))
                        tmp_criterion = or_(tmp_criterion, prop.ilike('%|_'+q+'%', escape='|'))
                criterion = and_(criterion, tmp_criterion)
        return criterion
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/controller.py/Crud_Controller.search_criterion/swapped operands of `in`