static TokenStream wrap(String fieldName,Analyzer indexAnalyzer,String content,char splitChar) throws IOException {
  if (indexAnalyzer.getOffsetGap(fieldName) != 1) {
    throw new IllegalArgumentException("offset gap of the provided analyzer should be 1 (field " + fieldName + ")");
  }
  int splitCharIdx=content.indexOf(splitChar);
  if (splitCharIdx == -1) {
    return indexAnalyzer.tokenStream(fieldName,content);
  }
  TokenStream subTokenStream=indexAnalyzer.tokenStream(fieldName,content.substring(0,splitCharIdx));
  return new MultiValueTokenStream(subTokenStream,fieldName,indexAnalyzer,content,splitChar,splitCharIdx);
}

static TokenStream wrap ( String fieldName , Analyzer indexAnalyzer , String content , char splitChar ) throws IOException { if ( indexAnalyzer . getOffsetGap ( fieldName ) != 1 ) { throw new IllegalArgumentException ( "offset gap of the provided analyzer should be 1 (field " + fieldName + ")" ) ; } int splitCharIdx = content . indexOf ( splitChar ) ; if ( splitCharIdx == - 1 ) { return indexAnalyzer . tokenStream ( fieldName , content ) ; } TokenStream subTokenStream = indexAnalyzer . tokenStream ( fieldName , content . substring ( 0 , splitCharIdx ) ) ; return new MultiValueTokenStream ( subTokenStream , fieldName , indexAnalyzer , content , splitChar , splitCharIdx ) ; }
note : the caller must remember to close the tokenstream eventually .
