def update_node(node, index=None, bulk=False, async_update=True, saved_fields=None): kwargs = { 'index': index, 'bulk': bulk } if async_update: node_id = node._id # We need the transaction to be committed before trying to run celery tasks. # For example, when updating a Node's privacy, is_public must be True in the # database in order for method that updates the Node's elastic search document # to run correctly. if settings.USE_CELERY: enqueue_task(search_engine.update_node_async.s(node_id=node_id, **kwargs)) else: search_engine.update_node_async(node_id=node_id, **kwargs) else: index = index or settings.ELASTIC_INDEX return search_engine.update_node(node, **kwargs)
def update_node(node, index=None, bulk=False, async_update=True, saved_fields=None): kwargs = {'index': index, 'bulk': bulk} if async_update: node_id = node._id # We need the transaction to be committed before trying to run celery tasks. # For example, when updating a Node's privacy, is_public must be True in the # database in order for method that updates the Node's elastic search document # to run correctly. if settings.USE_CELERY: enqueue_task( search_engine.update_node_async.s(node_id=node_id, **kwargs)) else: search_engine.update_node_async(node_id=node_id, **kwargs) else: index = index or settings.ELASTIC_INDEX return search_engine.update_node(node, **kwargs)
@requires_search def update_node(node, index=None, bulk=False, async=True, saved_fields=None): kwargs = {'index': index, 'bulk': bulk} if async: node_id = node._id # We need the transaction to be committed before trying to run celery tasks. # For example, when updating a Node's privacy, is_public must be True in the # database in order for method that updates the Node's elastic search document # to run correctly. if settings.USE_CELERY: enqueue_task( search_engine.update_node_async.s(node_id=node_id, **kwargs)) else: search_engine.update_node_async(node_id=node_id, **kwargs) else: index = index or settings.ELASTIC_INDEX return search_engine.update_node(node, **kwargs) @requires_search def bulk_update_nodes(serialize, nodes, index=None): index = index or settings.ELASTIC_INDEX search_engine.bulk_update_nodes(serialize, nodes, index=index) @requires_search def delete_node(node, index=None): index = index or settings.ELASTIC_INDEX doc_type = node.project_or_component
@requires_search def update_node(node, index=None, bulk=False, async=True): if async: node_id = node._id # We need the transaction to be committed before trying to run celery tasks. # For example, when updating a Node's privacy, is_public must be True in the # database in order for method that updates the Node's elastic search document # to run correctly. if settings.USE_CELERY: enqueue_task( search_engine.update_node_async.s(node_id=node_id, index=index, bulk=bulk)) else: search_engine.update_node_async(node_id=node_id, index=index, bulk=bulk) else: index = index or settings.ELASTIC_INDEX return search_engine.update_node(node, index=index, bulk=bulk) @requires_search def bulk_update_nodes(serialize, nodes, index=None): index = index or settings.ELASTIC_INDEX search_engine.bulk_update_nodes(serialize, nodes, index=index) @requires_search def delete_node(node, index=None): index = index or settings.ELASTIC_INDEX
def search(query, index=None, doc_type=None): index = index or settings.ELASTIC_INDEX return search_engine.search(query, index=index, doc_type=doc_type) @requires_search def update_node(node, index=None, bulk=False, async=True): if async: node_id = node._id # We need the transaction to be committed before trying to run celery tasks. # For example, when updating a Node's privacy, is_public must be True in the # database in order for method that updates the Node's elastic search document # to run correctly. if settings.USE_CELERY: enqueue_task(search_engine.update_node_async.s(node_id=node_id, index=index, bulk=bulk)) else: search_engine.update_node_async(node_id=node_id, index=index, bulk=bulk) else: index = index or settings.ELASTIC_INDEX return search_engine.update_node(node, index=index, bulk=bulk) @requires_search def bulk_update_nodes(serialize, nodes, index=None): index = index or settings.ELASTIC_INDEX search_engine.bulk_update_nodes(serialize, nodes, index=index) @requires_search def delete_node(node, index=None): index = index or settings.ELASTIC_INDEX doc_type = node.project_or_component if node.is_registration: doc_type = 'registration'
@requires_search def update_node(node, index=None, bulk=False, async=True, saved_fields=None): kwargs = { 'index': index, 'bulk': bulk } if async: node_id = node._id # We need the transaction to be committed before trying to run celery tasks. # For example, when updating a Node's privacy, is_public must be True in the # database in order for method that updates the Node's elastic search document # to run correctly. if settings.USE_CELERY: enqueue_task(search_engine.update_node_async.s(node_id=node_id, **kwargs)) else: search_engine.update_node_async(node_id=node_id, **kwargs) else: index = index or settings.ELASTIC_INDEX return search_engine.update_node(node, **kwargs) @requires_search def bulk_update_nodes(serialize, nodes, index=None): index = index or settings.ELASTIC_INDEX search_engine.bulk_update_nodes(serialize, nodes, index=index) @requires_search def delete_node(node, index=None): index = index or settings.ELASTIC_INDEX doc_type = node.project_or_component if node.is_registration: doc_type = 'registration'