#NEWLINE# def run_request( self , index = None , filename = None ) : #NEWLINE# #INDENT# if ( not index ) : #NEWLINE# #INDENT# self . show_index_list_panel ( self . run ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( not filename ) : #NEWLINE# #INDENT# self . show_input_filename ( 'Open: ' , self . settings . dump_file , index , self . run ) #NEWLINE# return #NEWLINE# #UNINDENT# count = 0 #NEWLINE# with open ( filename , encoding = 'utf-8' , mode = 'r' ) as f : #NEWLINE# #INDENT# for docs in readlines_chunks ( f ) : #NEWLINE# #INDENT# options = dict ( index = index , stats_only = False , chunk_size = self . settings . chunk_size , expand_action_callback = expand_action ) #NEWLINE# ( success , errors ) = bulk_index ( self . client , change_doc_index ( docs , index ) , ** options ) #NEWLINE# if errors : #NEWLINE# #INDENT# return dict ( command = self . command_name , index = index , filename = filename , status = 'ERROR' , errors = errors ) #NEWLINE# #UNINDENT# count += success #NEWLINE# sublime . status_message ( 'Load: {}' . format ( count ) ) #NEWLINE# #UNINDENT# #UNINDENT# return dict ( command = self . command_name , index = index , filename = filename , status = 'SUCCESS' , docs = count )