Naive search of the database for `query`.

    :return: A dict with keys 'artists', 'albums', and 'tracks'. Each containing a list
             of the respective ORM type.

def search(session, query):
    """Naive search of the database for `query`.

    :return: A dict with keys 'artists', 'albums', and 'tracks'. Each containing a list
             of the respective ORM type.
    """
    flat_query = "".join(query.split())

    artists = session.query(Artist).filter(
            or_(Artist.name.ilike(f"%%{query}%%"),
                Artist.name.ilike(f"%%{flat_query}%%"))
               ).all()
    albums = session.query(Album).filter(
            Album.title.ilike(f"%%{query}%%")).all()
    tracks = session.query(Track).filter(
            Track.title.ilike(f"%%{query}%%")).all()

    return dict(artists=artists,
                albums=albums,
                tracks=tracks)