#NEWLINE# def _process_search_results( builder , cur , alt , lang , limit ) : #NEWLINE# #INDENT# mapping = _mapping_from_cursor ( cur ) #NEWLINE# rv = [ ] #NEWLINE# files_needed = set ( ) #NEWLINE# for ( path , infos ) in iteritems ( mapping ) : #NEWLINE# #INDENT# info = _find_best_info ( infos , alt , lang ) #NEWLINE# if ( info is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# for parent in _iter_parents ( path ) : #NEWLINE# #INDENT# if ( parent not in mapping ) : #NEWLINE# #INDENT# files_needed . add ( parent ) #NEWLINE# #UNINDENT# #UNINDENT# rv . append ( info ) #NEWLINE# if ( len ( rv ) == limit ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# if files_needed : #NEWLINE# #INDENT# cur . execute ( ( '\n            select path, alt, lang, type, title\n              from source_info\n             where path in (%s)\n        ' % ', ' . join ( ( [ '?' ] * len ( files_needed ) ) ) ) , list ( files_needed ) ) #NEWLINE# mapping . update ( _mapping_from_cursor ( cur ) ) #NEWLINE# #UNINDENT# for info in rv : #NEWLINE# #INDENT# info [ 'parents' ] = _build_parent_path ( info [ 'path' ] , mapping , alt , lang ) #NEWLINE# #UNINDENT# return rv