@ SuppressWarnings ( "fallthrough" ) @ SuppressFBWarnings ( justification = "As this is an encoding method the fallthrough is intentional" , value = { "SF_SWITCH_NO_DEFAULT" } ) public static void appendEscapedLuceneQuery ( StringBuilder buf , final CharSequence text ) { if ( text == null || buf == null ) { return ; } for ( int i = 0 ; i < text . length ( ) ; i ++ ) { final char c = text . charAt ( i ) ; switch ( c ) { case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : //it is supposed to fall through here buf . append ( ' ' ) ; default : buf . append ( c ) ; break ; } } }
Appends the text to the supplied StringBuilder escaping Lucene control characters in the process .