#NEWLINE# def store_similarities( self , itemMatch ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# logger . info ( 'saving similarities' ) #NEWLINE# count = 0 #NEWLINE# for ( object_id , scores ) in itemMatch : #NEWLINE# #INDENT# ( object_target , object_target_site ) = self . resolve_identifier ( object_id ) #NEWLINE# for ( related_object_id , score ) in scores : #NEWLINE# #INDENT# if ( ( not math . isnan ( score ) ) and ( score > self . threshold_similarities ) ) : #NEWLINE# #INDENT# ( object_related , object_related_site ) = self . resolve_identifier ( related_object_id ) #NEWLINE# if ( object_target != object_related ) : #NEWLINE# #INDENT# count = ( count + 1 ) #NEWLINE# Similarity . objects . set_score_for_objects ( object_target = object_target , object_target_site = object_target_site , object_related = object_related , object_related_site = object_related_site , score = score ) #NEWLINE# if ( ( count % RECOMMENDS_STORAGE_COMMIT_THRESHOLD ) == 0 ) : #NEWLINE# #INDENT# logger . debug ( ( 'saved %s similarities...' % count ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# logger . info ( ( 'saved %s similarities...' % count ) )