#NEWLINE# def _add_vec( self , docid , term_vec ) : #NEWLINE# #INDENT# 'Add term_vec to the index' #NEWLINE# term_index = defaultdict ( list ) #NEWLINE# for ( term , freq ) in term_vec . iteritems ( ) : #NEWLINE# #INDENT# term_index [ term ] . append ( ( term , freq ) ) #NEWLINE# #UNINDENT# for ( term , new_postings ) in term_index . items ( ) : #NEWLINE# #INDENT# self . _term_index [ term ] = ( self . postings_list ( term ) + new_postings )