public static String escapeLuceneQuery(final CharSequence text) {
        if (text == null) {
            return null;
        }
        final int size = text.length() << 1;
        final StringBuilder buf = new StringBuilder(size);
        appendEscapedLuceneQuery(buf, text);
        return buf.toString();
    }
@Test
    public void testEscapeLuceneQuery() {
        CharSequence text = "test encoding + - & | ! ( ) { } [ ] ^ \" ~ * ? : \\";
        String expResult = "test encoding \\+ \\- \\& \\| \\! \\( \\) \\{ \\} \\[ \\] \\^ \\\" \\~ \\* \\? \\: \\\\";
        String result = LuceneUtils.escapeLuceneQuery(text);
        assertEquals(expResult, result);
    }