def _escape_lucene_query(query, field=None):
        """
        Escapes special characters in Solr queries.
        Note that this omits * - this is intentionally permitted in user queries.
        The list of special characters is located at http://lucene.apache.org/core/4_0_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Escaping_Special_Characters
        """
        replacement = r"\\\1"
        return re.sub(r'([\'" +\-!\(\)\{\}\[\]^"~?:\\/]|&&|\|\|)', replacement, query)