예제 #1
0
 def get_num_items(self):
     """
     Get the number of indexed items.
     """
     search_index = SearchIndex()
     print "Number of indexed items: %s" % search_index.index_obj.doc_count()
     search_index.close()
예제 #2
0
 def get_search_speed(self):
     """
     Get the average speed at which searches are performed over a predefined
     list of random keywords.
     """
     search_index = SearchIndex()
     result_time = []
     for q in ['dog', 'cat', 'website', 'news', 'social']:
         start_time = time.clock()
         results = search_index.search(q)
         end_time = time.clock()
         result_time.append(end_time - start_time)
     
     search_index.close()
     print "Average search speed: %s secs" % (round(sum(result_time) / len(result_time), 2))