9
9
10
10
11
11
def _get_index (indices , index_name ):
12
+ """
13
+ Get Index from all the indices
14
+ :param indices: DED indices list
15
+ :param index_name: Name of the index
16
+ :return: DED Index
17
+ """
12
18
for index in indices :
13
19
if str (index ) == index_name :
14
20
return index
15
21
16
22
17
23
def _get_document (model , document_class ):
24
+ """
25
+ Get DED document class object from the model and name of document class
26
+ :param model: The model class to find the document
27
+ :param document_class: the name of the document class.
28
+ :return: DED DocType object
29
+ """
18
30
documents = registry .get_documents (models = [model ])
19
31
20
32
for document in documents :
@@ -23,7 +35,7 @@ def _get_document(model, document_class):
23
35
24
36
25
37
@app .task (queue = 'web' )
26
- def create_new_es_index_task (app_label , model_name , index_name , new_index_name ):
38
+ def create_new_es_index (app_label , model_name , index_name , new_index_name ):
27
39
model = apps .get_model (app_label , model_name )
28
40
indices = registry .get_indices (models = [model ])
29
41
old_index = _get_index (indices = indices , index_name = index_name )
@@ -32,7 +44,7 @@ def create_new_es_index_task(app_label, model_name, index_name, new_index_name):
32
44
33
45
34
46
@app .task (queue = 'web' )
35
- def switch_es_index_task (app_label , model_name , index_name , new_index_name ):
47
+ def switch_es_index (app_label , model_name , index_name , new_index_name ):
36
48
model = apps .get_model (app_label , model_name )
37
49
indices = registry .get_indices (models = [model ])
38
50
old_index = _get_index (indices = indices , index_name = index_name )
@@ -54,7 +66,7 @@ def switch_es_index_task(app_label, model_name, index_name, new_index_name):
54
66
55
67
56
68
@app .task (queue = 'web' )
57
- def index_objects_to_es_task (app_label , model_name , document_class , index_name , objects_id ):
69
+ def index_objects_to_es (app_label , model_name , document_class , index_name , objects_id ):
58
70
model = apps .get_model (app_label , model_name )
59
71
document = _get_document (model = model , document_class = document_class )
60
72
@@ -65,7 +77,7 @@ def index_objects_to_es_task(app_label, model_name, document_class, index_name,
65
77
66
78
67
79
@app .task (queue = 'web' )
68
- def index_missing_objects_task (app_label , model_name , document_class , indexed_instance_ids ):
80
+ def index_missing_objects (app_label , model_name , document_class , indexed_instance_ids ):
69
81
"""
70
82
Task to insure that none of the object is missed from indexing.
71
83
0 commit comments