def handle(self, *args, **options): if options["operation"] == "setup_indexes": self.setup_indexes() if options["operation"] == "add_index": self.register_index(name=options["name"]) if options["operation"] == "delete_indexes": self.delete_indexes() if options["operation"] == "delete_index": self.remove_index(name=options["name"]) if options["operation"] == "index_database": if options["name"] is not None: index_database.index_resources( clear_index=options["clear_index"], index_name=options["name"], batch_size=options["batch_size"]) else: index_database.index_db(clear_index=options["clear_index"], batch_size=options["batch_size"]) if options["operation"] == "index_concepts": index_database.index_concepts(clear_index=options["clear_index"], batch_size=options["batch_size"]) if options["operation"] == "index_resources": index_database.index_resources(clear_index=options["clear_index"], batch_size=options["batch_size"]) if options["operation"] == "index_resource_relations": index_database.index_resource_relations( clear_index=options["clear_index"], batch_size=options["batch_size"])
def handle(self, *args, **options): if options['operation'] == 'setup_indexes': self.setup_indexes() if options['operation'] == 'add_index': self.register_index(name=options['name']) if options['operation'] == 'delete_indexes': self.delete_indexes() if options['operation'] == 'delete_index': self.remove_index(name=options['name']) if options['operation'] == 'index_database': if options['name'] is not None: index_database.index_resources( clear_index=options['clear_index'], index_name=options['name'], batch_size=options['batch_size']) else: index_database.index_db(clear_index=options['clear_index'], batch_size=options['batch_size']) if options['operation'] == 'index_concepts': index_database.index_concepts(clear_index=options['clear_index'], batch_size=options['batch_size']) if options['operation'] == 'index_resources': index_database.index_resources(clear_index=options['clear_index'], batch_size=options['batch_size']) if options['operation'] == 'index_resource_relations': index_database.index_resource_relations( clear_index=options['clear_index'], batch_size=options['batch_size'])
def index_database(self, batch_size, clear_index, name): if name is not None: index_database_util.index_resources( clear_index=clear_index, index_name=name, batch_size=batch_size, ) else: index_database_util.index_db(clear_index=clear_index, batch_size=batch_size)
def index_database(self, batch_size, clear_index=True, name=None, quiet=False): if name is not None: index_database_util.index_custom_indexes(index_name=name, clear_index=clear_index, batch_size=batch_size, quiet=quiet) else: index_database_util.index_db(clear_index=clear_index, batch_size=batch_size, quiet=quiet)
def handle(self, *args, **options): # if both are false, then the whole db should be indexed. if options['concepts'] is False and options['resources'] is False: index_db() elif options['concepts'] is True: index_db(resources=False) elif options['resources'] is True: index_db(concepts=False)
def handle(self, *args, **options): if options['operation'] == 'install': self.install(install_location=options['dest_dir'], port=options['port']) # if options['operation'] == 'start': # self.start(install_location=options['dest_dir']) if options['operation'] == 'setup_indexes': self.setup_indexes() if options['operation'] == 'delete_indexes': self.delete_indexes() if options['operation'] == 'index_database': index_database.index_db(clear_index=options['clear_index'], batch_size=options['batch_size']) if options['operation'] == 'index_concepts': index_database.index_concepts(clear_index=options['clear_index'], batch_size=options['batch_size']) if options['operation'] == 'index_resources': index_database.index_resources(clear_index=options['clear_index'], batch_size=options['batch_size']) if options['operation'] == 'index_resource_relations': index_database.index_resource_relations(clear_index=options['clear_index'], batch_size=options['batch_size'])
def index_database(self, package_name): """ Runs the index_database command found in package_utils """ # self.setup_indexes(package_name) index_database.index_db()
def truncate_resources(): """Deletes ALL resources in your database. Use with caution!""" cursor = connection.cursor() cursor.execute("""TRUNCATE data.entities CASCADE;""" ) index_database.index_db() print 'Resources Truncated'
def truncate_resources(): """Deletes ALL resources in your database. Use with caution!""" cursor = connection.cursor() cursor.execute("""TRUNCATE data.entities CASCADE;""" ) index_database.index_db(concepts=False) print 'Resources Truncated'