#NEWLINE# def _query( self , query_vec ) : #NEWLINE# #INDENT# 'Finds documents similar to query_vec\n        \n        Params:\n            query_vec: term vector representing query document\n        \n        Returns:\n            A iterable of (docname, score) tuples sorted by score\n        ' #NEWLINE# postings_lists = [ ] #NEWLINE# for term in query_vec : #NEWLINE# #INDENT# postings_lists . append ( ( term , self . postings_list ( term ) ) ) #NEWLINE# #UNINDENT# N = ( self . _global_N or self . _N ) #NEWLINE# hits = self . query_scorer . score_docs ( query_vec = query_vec , postings_lists = postings_lists , N = N , get_doc_freq = self . get_doc_freq , get_doc_len = self . get_doc_len ) #NEWLINE# return ( ( self . docid_to_name ( docid ) , score ) for ( docid , score ) in self )