def index_relations(sender, pid_type, json=None,
                    record=None, index=None, **kwargs):
    """Add relations to the indexed record."""
    if not json:
        json = {}
    pid = PersistentIdentifier.query.filter(
        PersistentIdentifier.object_uuid == record.id,
        PersistentIdentifier.pid_type == pid_type,
    ).one_or_none()
    relations = None
    if pid:
        relations = serialize_relations(pid)
        if relations:
            json['relations'] = relations
    return json
Add relations to the indexed record.