T53161 proces feedback sybren, replace angolia with search

This commit is contained in:
2017-11-03 16:40:02 +01:00
parent 2233d015f3
commit fcf19de786
7 changed files with 61 additions and 40 deletions

View File

@@ -1,30 +1,45 @@
import logging
from . import algolia_tasks
from pillar import current_app
from . import algolia_indexing
# from . import elastic_indexing
log = logging.getLogger(__name__)
# TODO(stephan) make index backend conditional on settings.
# TODO make index backend conditional on settings.
# now uses angolia, but should use elastic
SEARCH_BACKENDS = {
'algolia': algolia_indexing,
'elastic': None, # elastic_indexing
}
@current_app.celery.task(ignore_result=True)
def updated_user(user_id: str):
"""Push an update to the index when a user item is updated"""
algolia_tasks.push_updated_user_to_algolia(user_id)
algolia_indexing.push_updated_user(user_id)
@current_app.celery.task(ignore_result=True)
def node_save(node_id: str):
algolia_tasks.index_node_save(node_id)
algolia_indexing.index_node_save(node_id)
@current_app.celery.task(ignore_result=True)
def node_delete(node_id: str):
algolia_tasks.index_node_delete(node_id)
algolia_indexing.index_node_delete(node_id)
def build_doc_to_index_from(node: dict):
"""
Given node build an to_index document
"""
pass