def harvest_sources_reindex(context, data_dict): ''' Reindexes all harvest source datasets with the latest status ''' log.info('Reindexing all harvest sources') check_access('harvest_sources_reindex', context, data_dict) model = context['model'] packages = model.Session.query(model.Package) \ .filter(model.Package.type == DATASET_TYPE_NAME) \ .filter(model.Package.state == u'active') \ .all() package_index = PackageSearchIndex() reindex_context = {'defer_commit': True} for package in packages: get_action('harvest_source_reindex')(reindex_context, { 'id': package.id }) package_index.commit() return True
def harvest_sources_reindex(context, data_dict): """ Reindexes all harvest source datasets with the latest status """ log.info("Reindexing all harvest sources") check_access("harvest_sources_reindex", context, data_dict) model = context["model"] packages = ( model.Session.query(model.Package) .filter(model.Package.type == DATASET_TYPE_NAME) .filter(model.Package.state == u"active") .all() ) package_index = PackageSearchIndex() for package in packages: if "extras_as_string" in context: del context["extras_as_string"] context.update({"validate": False, "ignore_auth": True}) package_dict = logic.get_action("package_show")(context, {"id": package.id}) log.debug("Updating search index for harvest source {0}".format(package.id)) package_index.index_package(package_dict, defer_commit=True) package_index.commit() log.info("Updated search index for {0} harvest sources".format(len(packages)))
def harvest_sources_reindex(context, data_dict): ''' Reindexes all harvest source datasets with the latest status ''' log.info('Reindexing all harvest sources') check_access('harvest_sources_reindex', context, data_dict) model = context['model'] packages = model.Session.query(model.Package) \ .filter(model.Package.type==DATASET_TYPE_NAME) \ .filter(model.Package.state==u'active') \ .all() package_index = PackageSearchIndex() for package in packages: if 'extras_as_string'in context: del context['extras_as_string'] context.update({'ignore_auth': True}) package_dict = logic.get_action('harvest_source_show')(context, {'id': package.id}) log.debug('Updating search index for harvest source {0}'.format(package.id)) package_index.index_package(package_dict, defer_commit=True) package_index.commit() log.info('Updated search index for {0} harvest sources'.format(len(packages)))
def harvest_sources_reindex(context, data_dict): """ Reindexes all harvest source datasets with the latest status """ log.info("Reindexing all harvest sources") check_access("harvest_sources_reindex", context, data_dict) model = context["model"] packages = ( model.Session.query(model.Package) .filter(model.Package.type == DATASET_TYPE_NAME) .filter(model.Package.state == u"active") .all() ) package_index = PackageSearchIndex() reindex_context = {"defer_commit": True} for package in packages: get_action("harvest_source_reindex")(reindex_context, {"id": package.id}) package_index.commit() return True
def harvest_sources_reindex(context, data_dict): ''' Reindexes all harvest source datasets with the latest status ''' log.info('Reindexing all harvest sources') check_access('harvest_sources_reindex', context, data_dict) model = context['model'] packages = model.Session.query(model.Package) \ .filter(model.Package.type==DATASET_TYPE_NAME) \ .filter(model.Package.state==u'active') \ .all() package_index = PackageSearchIndex() for package in packages: if 'extras_as_string' in context: del context['extras_as_string'] context.update({'validate': False, 'ignore_auth': True}) package_dict = logic.get_action('package_show')(context, { 'id': package.id }) log.debug('Updating search index for harvest source {0}'.format( package.id)) package_index.index_package(package_dict, defer_commit=True) package_index.commit() log.info('Updated search index for {0} harvest sources'.format( len(packages)))
def harvest_sources_reindex(context, data_dict): ''' Reindexes all harvest source datasets with the latest status ''' log.info('Reindexing all harvest sources') check_access('harvest_sources_reindex', context, data_dict) model = context['model'] packages = model.Session.query(model.Package) \ .filter(model.Package.type==DATASET_TYPE_NAME) \ .filter(model.Package.state==u'active') \ .all() package_index = PackageSearchIndex() reindex_context = {'defer_commit': True} for package in packages: get_action('harvest_source_reindex')(reindex_context, {'id': package.id}) package_index.commit() return True