def main(self):
<EOL>primary_bool = True<EOL>no_records = True<EOL>nsearch = <NUM_LIT:1><EOL>search_terms = self.terms<EOL>original_names = []<EOL>while True:<EOL><INDENT>if primary_bool:<EOL><INDENT>self.logger.info('<STR_LIT>'.format(<EOL>self.primary_datasource))<EOL><DEDENT>else:<EOL><INDENT>self.logger.info('<STR_LIT>')<EOL><DEDENT>res = self._res.search(search_terms, prelim=primary_bool)<EOL>if nsearch > <NUM_LIT:2> and res:<EOL><INDENT>for each_res, original_name in zip(res, original_names):<EOL><INDENT>each_res['<STR_LIT>'] = original_name<EOL><DEDENT><DEDENT>self._store.add(res)<EOL>no_records = self._count(nrecords=<NUM_LIT:1>)<EOL>if no_records:<EOL><INDENT>if nsearch == <NUM_LIT:1>:<EOL><INDENT>primary_bool = False<EOL><DEDENT>elif nsearch == <NUM_LIT:2>:<EOL><INDENT>original_names = no_records<EOL>no_records = [e.split()[<NUM_LIT:0>] for e in no_records]<EOL>primary_bool = True<EOL><DEDENT>elif nsearch == <NUM_LIT:3>:<EOL><INDENT>original_names = no_records<EOL>no_records = [e.split()[<NUM_LIT:0>] for e in no_records]<EOL>primary_bool = False<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT>nsearch += <NUM_LIT:1><EOL>search_terms = no_records<EOL><DEDENT>multi_records = self._count(greater=True, nrecords=<NUM_LIT:1>)<EOL>if multi_records:<EOL><INDENT>self.logger.info('<STR_LIT>')<EOL>res = self._sieve(multi_records)<EOL>self._store.replace(res)<EOL><DEDENT>
Search and sieve query names.