public String codeCleanPipeline(String contents){
  if (contents == null) {
    return Values.EMPTYSTRING;
  }
  StringBuilder indexContents=new StringBuilder();
  char[] firstReplacements={'<','>',')','(','[',']','|','=',','};
  for (  char c : firstReplacements) {
    contents=contents.replace(c,' ');
  }
  indexContents.append(" ");
  indexContents.append(contents);
  char[] secondReplacements={';','{','}','/'};
  for (  char c : secondReplacements) {
    contents=contents.replace(c,' ');
  }
  indexContents.append(" ");
  indexContents.append(contents);
  char[] forthReplacements={'"','\''};
  for (  char c : forthReplacements) {
    contents=contents.replace(c,' ');
  }
  indexContents.append(" ");
  indexContents.append(contents);
  char[] replacements={'\'','"','.',';','=','(',')','[',']','_',';','@','#'};
  for (  char c : replacements) {
    contents=contents.replace(c,' ');
  }
  indexContents.append(" ");
  indexContents.append(contents);
  char[] thirdReplacements={'-'};
  for (  char c : thirdReplacements) {
    contents=contents.replace(c,' ');
  }
  indexContents.append(" ");
  indexContents.append(contents);
  return indexContents.toString();
}

public String codeCleanPipeline ( String contents ) { if ( contents == null ) { return Values . EMPTYSTRING ; } StringBuilder indexContents = new StringBuilder ( ) ; char [ ] firstReplacements = { '<' , '>' , ')' , '(' , '[' , ']' , '|' , '=' , ',' } ; for ( char c : firstReplacements ) { contents = contents . replace ( c , ' ' ) ; } indexContents . append ( " " ) ; indexContents . append ( contents ) ; char [ ] secondReplacements = { ';' , '{' , '}' , '/' } ; for ( char c : secondReplacements ) { contents = contents . replace ( c , ' ' ) ; } indexContents . append ( " " ) ; indexContents . append ( contents ) ; char [ ] forthReplacements = { '"' , '\'' } ; for ( char c : forthReplacements ) { contents = contents . replace ( c , ' ' ) ; } indexContents . append ( " " ) ; indexContents . append ( contents ) ; char [ ] replacements = { '\'' , '"' , '.' , ';' , '=' , '(' , ')' , '[' , ']' , '_' , ';' , '@' , '#' } ; for ( char c : replacements ) { contents = contents . replace ( c , ' ' ) ; } indexContents . append ( " " ) ; indexContents . append ( contents ) ; char [ ] thirdReplacements = { '-' } ; for ( char c : thirdReplacements ) { contents = contents . replace ( c , ' ' ) ; } indexContents . append ( " " ) ; indexContents . append ( contents ) ; return indexContents . toString ( ) ; }
cleans and formats the code into something that can be indexed by lucene while supporting searches such as i + + matching for ( int i = 0 ; i < 100 ; i + + ; ) {
