def compile_collection(self, collection_id):
        matchers = defaultdict(set)
        q = db.session.query(Entity)
        q = q.filter(Entity.collection_id == collection_id)
        q = q.filter(Entity.deleted_at == None)  # noqa
        for entity in q:
            for term in entity.terms:
                matchers[normalize_strong(term)].add(entity.id)
        body = '|'.join(matchers.keys())
        rex = re.compile(body % '( |^)(%s)( |$)')
        return rex, matchers
dataset/ETHPy150Open pudo/aleph/aleph/analyze/entities.py/EntityCache.compile_collection/swapped operands of `%`