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