def handle(self, *args, **options): self.sfm = superfastmatch.DjangoClient() for search_doc in SearchDocument.objects.all(): print u"Updating {0}: {1}".format(search_doc.uuid, search_doc.title or "(untitled)") response = execute_search(search_doc) record_matches(search_doc, response, update_matches=True) prune_old_matches(search_doc, response)
def handle(self, uuid, *args, **options): self.sfm = superfastmatch.DjangoClient() search_doc = SearchDocument.objects.get(uuid=uuid) if search_doc: print u"Updating {0}: {1}".format(search_doc.uuid, search_doc.title or "(untitled)") response = execute_search(search_doc) record_matches(search_doc, response, update_matches=True) prune_old_matches(search_doc, response) else: raise CommandError(u"No such search document: {}".format(uuid))