SolrUtils { public static String clean(String q) { return q.replaceAll(charCleanerRegex, "\\\\$1") .replaceAll("\\&\\&", "\\\\&\\\\&") .replaceAll("\\|\\|", "\\\\|\\\\|"); } private  SolrUtils(); static String clean(String q); static String serializeDate(Date date); static Date parseDate(String date); static String serializeDateRange(Option<Date> startDate, Option<Date> endDate); static DateFormat newSolrDateFormat();  }
@Test public void testClean() { String test = "+-!(){}[]^\"~*?:&&||&|"; String expected = "\\+\\-\\!\\(\\)\\{\\}\\[\\]\\^\\\"\\~\\*\\?\\:\\&\\&\\|\\|&|"; assertEquals(expected, SolrUtils.clean(test)); }