public void addDocument ( String ... fields ) { for ( int i = 0 ; i < fields . length ; i ++ ) { final DataType type = schema . getType ( i ) ; String field = fields [ i ] ; final Map < String , Set < Integer > > stringSetMap = this . fields . get ( i ) ; if ( type == DataType . DateYear ) { // reformat field value for date year field = field . split ( "-" ) [ 0 ] ; } Set < Integer > integers = stringSetMap . get ( field ) ; if ( integers == null ) { integers = new TreeSet <> ( ) ; } integers . add ( docPosition ) ; stringSetMap . put ( field , integers ) ; } docPosition ++ ; }
add fields on index