def escape_solr_query(query):
    """
    Escape special chars for Solr queries.
    """
    chars = ['+', '-', '&&', '||', '!', '(', ')', '{', '}', '[', ']', '^', '"', '~', '*', '?',
             ':', '/', ' ']
    for char in chars:
        query = query.replace(char, '\{}'.format(char))

    return query