def prepare_search(self, query_string): """ Prepares the threaded search system for running efficiently in multiple threads """ # Initialize the Search Engine and the IEEE Processor se = SearchEngine() processor = IEEEProcessor() # First, run the test query at the server query_results = se.make_test_query(query_string) # Second, read the results into XML parser root element root = ET.fromstring(query_results) # Third, get the amount of found results self._total_found = processor.get_amount_entries_found(root) self._calculate_amount_threads(self._total_found)
def create_and_perform_query(queryText, results, start_point): # Perform the query # First, create the search engine client se = SearchEngine() # Second, set the query se.set_query(queryText) # Third, set the paging (get full 100, start with the given point) se.set_paging(100, start_point) # Fourth, set filtering # TODO: Missing filtering # Five, perform the query se.perform_query() # Six, get the results res = se.get_results() # Put it to the queue results.put(res) # Give some info on what has happened so far end_point = start_point+100 print(str(start_point) + " - " + str(end_point) + " results parsed")